private void SetCenterVector(Point3d OriginPoint, double zr) { this.TZRotation += zr; Point3d position = new Point3d(this.XOrigin, this.YOrigin, this.ZOrigin); position = (OriginPoint == Point3d.Origin) ? position : position.TransformBy(Matrix3d.Displacement(new Vector3d(OriginPoint.X, OriginPoint.Y, OriginPoint.Z))); position = position.TransformBy(Matrix3d.Rotation(zr / 180 * System.Math.PI, Vector3d.ZAxis, OriginPoint)); this.TXOrigin = position.X; this.TYOrigin = position.Y; this.TZOrigin = position.Z; Vector3d BaseVector = new Vector3d();//定位向量 if (BasePoint == 1) { BaseVector = new Vector3d(-Length / 2, -Width / 2, -Thickness / 2); } else if (BasePoint == 2) { BaseVector = new Vector3d(-Length / 2, -Width / 2, Thickness / 2); } else if (BasePoint == 3) { BaseVector = new Vector3d(-Length / 2, Width / 2, -Thickness / 2); } else if (BasePoint == 4) { BaseVector = new Vector3d(-Length / 2, Width / 2, Thickness / 2); } else if (BasePoint == 5) { BaseVector = new Vector3d(Length / 2, Width / 2, -Thickness / 2); } else if (BasePoint == 6) { BaseVector = new Vector3d(Length / 2, Width / 2, Thickness / 2); } else if (BasePoint == 7) { BaseVector = new Vector3d(Length / 2, -Width / 2, -Thickness / 2); } else if (BasePoint == 8) { BaseVector = new Vector3d(Length / 2, -Width / 2, Thickness / 2); } else { throw new System.Exception("Unknown Basepoint" + BasePoint.ToString()); } Vector3d MoveVector = MathHelper.GetRotateVector(BaseVector, TXRotation, TYRotation, TZRotation); Vector3d DimVector = new Vector3d(TXOrigin, TYOrigin, TZOrigin); CenterVector = -MoveVector + DimVector; }