public PointF[] GetProjection(Point3d[] pts) { PointF[] pt2ds = new PointF[pts.Length]; // transform to new coordinates system which origin is camera location Point3d[] pts1 = Point3d.Copy(pts); Point3d.Offset(pts1, -loc.X, -loc.Y, -loc.Z); // rotate quan.Rotate(pts1); //project for (int i = 0; i < pts.Length; i++) { if (pts1[i].Z > 0.1) { pt2ds[i] = new PointF((float)(loc.X + pts1[i].X * _d / pts1[i].Z), (float)(loc.Y + pts1[i].Y * _d / pts1[i].Z)); } else { pt2ds[i] = new PointF(float.MaxValue, float.MaxValue); } } return(pt2ds); }
public void RotateAt(Point3d pt, Quaternion q) { // transform origin to pt Point3d[] copy = Point3d.Copy(pts); Point3d.Offset(copy, -pt.X, -pt.Y, -pt.Z); // rotate q.Rotate(copy); q.Rotate(center); // transform to original origin Point3d.Offset(copy, pt.X, pt.Y, pt.Z); pts = copy; }