How to offset/translate a Point in PointsVisual3D
pyrrhicpk wrote at 2012-11-06 07:29:
Hi,
I am drawing two points in the helixviewport3d using the following code. How can I offset/translate the points to new positions?
var result = new Point3DCollection(n); var pt1 = new Point3D(0, 0, 0); var pt2 = new Point3D(5, 5, 5); result.Add(pt1); result.Add(pt2);
VisualPoints = new PointsVisual3D();
VisualPoints.Points = result;
myhelixviewport3d.Children.Add(VisualPoints);
objo wrote at 2012-11-06 19:31:
see
http://msdn.microsoft.com/en-us/library/system.windows.media.media3d.visual3d.transform.aspx
and
http://msdn.microsoft.com/en-us/library/system.windows.media.media3d.translatetransform3d.aspx
pyrrhicpk wrote at 2012-11-07 03:58:
Actually, I want to translate the two points to different locations. Applying translate transform to the VisualPoints would result in the translation of both the points to the same new location. Am I right in this?
Actually, I have about 300,000 points in "result" and I want to translate each point to a new position. I tried doing result[0].Offset(xnew,ynew,znew); but I found that the offset applies on a copy and not on the original point. So, other possible way is to replace all the points in "result" with new points (with new positions). Are there any other workarounds?
Customer support service by UserEcho