Hi .. I draw two spheres in 3d WPF which has points like Point3D(0,0,0) and Point3D(-1.0,1.0,2.0) with the radius is 0.10
Now i want to draw a Cylinder joining these spheres, the only thing i have for this is radius 0.02. I want to know how to calculate the 3d point, height, direction etc for this cylinder.
I tried by finding the midpoint btw sphere points, it's placing the cylinder in the middle of those two spheres but not in the right direction. I am trying to rotate using in the code below.
Vector3D v1 = new Vector3D(0, 0, 0);
Vector3D v2 = new Vector3D(1.0, -1.0, 2.0);
Vector3D center = v1+ v2/2;
Vector3D axis = Vector3D.CrossProduct(v1, v2);
double angle = Vector3D.AngleBetween(v1, v2);
AxisAngleRotation3D axisAngle = new AxisAngleRotation3D(axis, angle);
RotateTransform3D myRotateTransform = new RotateTransform3D(axisAngle, center);
center.X = myRotateTransform.CenterX;
center.Y = myRotateTransform.CenterY;
center.Z = myRotateTransform.CenterZ;
but the double angle = Vector3D.AngleBetween(v1, v2); ruselting NaN
It would be really nice, if someone could help in doing this. Thanks in advance.