Click here to Skip to main content
16,006,531 members
Home / Discussions / WPF
   

WPF

 
QuestionRetrieving icons associated with installed Printers for use in C# and WPF Pin
Alisaunder20-Nov-11 12:55
Alisaunder20-Nov-11 12:55 
AnswerRe: Retrieving icons associated with installed Printers for use in C# and WPF Pin
SledgeHammer0120-Nov-11 17:32
SledgeHammer0120-Nov-11 17:32 
GeneralRe: Retrieving icons associated with installed Printers for use in C# and WPF Pin
Alisaunder20-Nov-11 18:24
Alisaunder20-Nov-11 18:24 
AnswerRe: Retrieving icons associated with installed Printers for use in C# and WPF Pin
Wayne Gaylard20-Nov-11 18:49
professionalWayne Gaylard20-Nov-11 18:49 
GeneralRe: Retrieving icons associated with installed Printers for use in C# and WPF Pin
Alisaunder21-Nov-11 5:15
Alisaunder21-Nov-11 5:15 
GeneralRe: Retrieving icons associated with installed Printers for use in C# and WPF Pin
SledgeHammer0121-Nov-11 6:18
SledgeHammer0121-Nov-11 6:18 
QuestionRotating 3d cylinder to a specific direction (Vector3d) Pin
ekoman20-Nov-11 1:17
ekoman20-Nov-11 1:17 
AnswerRe: Rotating 3d cylinder to a specific direction (Vector3d) Pin
ekoman20-Nov-11 4:05
ekoman20-Nov-11 4:05 
Ah, I think I've figured it out - and learned a bit more about WPF 3d graphics! Havent written the code for it yet (not at the office), but posting a follow-up just if someone else stumbles upon this on the net.

My first mistake: rotation transforms (any transforms) arent cumulative. If I apply a rotation transform and need to modify the rotation later on, I dont need to redo the previous rotation before the second one. The original coordinates of the GeometryModel3D remains the same all the time - I just apply my new rotation and it will replace the old one.

My cylinder is standing on the xz-plane, pointing up on the y-axis with length 1. Scaling is no problem - I just scale it in the y-direction according to the distance between the two nodes.

Rotation was trickier but I think I have figured it out. To rotate the GeometryModel3d, I use the AxisAngleRotation3D(Vector3d, angle) class for the RotateTransform3D for the GeometryModel3d object.

What I need is the axis to rotate around, plus the number of degree to rotate. As the cylinder stands on the xz-plane, the rotation axis will always be on this plane. Based on the nodal coordinate P(x1,y1,z1), I get the rotation axis by simply setting Vrotate=(-z1,0,x1). So if I want to rotate my cylinder towards Point3d(2,3,1), I set the rotation axis to be Vector3d(-1,0,2)!

The rotation degree is the angle between a Vector3d(x,y,z) and the Y-axis (0,1,0), which is easily calculated by the shorthand:

theta = arccos( y / sqrt(x²+y²+z²) )

(...as the y-axis is normalized and, yes, on the y-axis!)

I thus end up with arguments for the AxisAngleRotation3D constructor, making it easy to rotate my cylinder towards the desired point!

Of course, the example above assumes that the first node is on the origo: the above must of course be modified to accept two arbitrary Point3d coordinates...
QuestionHow to remove the border when mouse enter a listboxitem Pin
Loveisasea19-Nov-11 17:41
Loveisasea19-Nov-11 17:41 
AnswerRe: How to remove the border when mouse enter a listboxitem Pin
Abhinav S20-Nov-11 2:38
Abhinav S20-Nov-11 2:38 
AnswerRe: How to remove the border when mouse enter a listboxitem Pin
Mark Salsbery20-Nov-11 8:04
Mark Salsbery20-Nov-11 8:04 
Questionsilverlight web site performance Pin
delibey19-Nov-11 14:17
delibey19-Nov-11 14:17 
AnswerRe: silverlight web site performance Pin
Abhinav S20-Nov-11 2:21
Abhinav S20-Nov-11 2:21 
AnswerRe: silverlight web site performance Pin
Mark Salsbery20-Nov-11 8:07
Mark Salsbery20-Nov-11 8:07 
SuggestionRe: silverlight web site performance Pin
delibey21-Nov-11 4:09
delibey21-Nov-11 4:09 
GeneralRe: silverlight web site performance Pin
Pete O'Hanlon21-Nov-11 4:12
mvePete O'Hanlon21-Nov-11 4:12 
GeneralRe: silverlight web site performance Pin
Mark Salsbery21-Nov-11 4:51
Mark Salsbery21-Nov-11 4:51 
QuestionWPF MVVM DataGrid Cell Changed Pin
Kevin Marois19-Nov-11 9:29
professionalKevin Marois19-Nov-11 9:29 
AnswerRe: WPF MVVM DataGrid Cell Changed Pin
Pete O'Hanlon19-Nov-11 10:58
mvePete O'Hanlon19-Nov-11 10:58 
QuestionWPF Nested Treeviews Pin
Kevin Marois19-Nov-11 8:19
professionalKevin Marois19-Nov-11 8:19 
QuestionHow to add Scrollviewer inside Dragdockpanel? Pin
Dhivakar.M18-Nov-11 2:04
Dhivakar.M18-Nov-11 2:04 
AnswerRe: How to add Scrollviewer inside Dragdockpanel? Pin
Shmuel Zang19-Nov-11 9:28
Shmuel Zang19-Nov-11 9:28 
QuestionDrag and Drop Listbox in Windows Phone 7.1 Pin
rajeevkuth17-Nov-11 23:25
rajeevkuth17-Nov-11 23:25 
AnswerRe: Drag and Drop Listbox in Windows Phone 7.1 Pin
Loveisasea19-Nov-11 18:22
Loveisasea19-Nov-11 18:22 
GeneralRe: Drag and Drop Listbox in Windows Phone 7.1 Pin
rajeevkuth22-Nov-11 0:36
rajeevkuth22-Nov-11 0:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.