Esempio n. 1
0
        /// <summary>
        /// Rotates the object about the reference point.
        /// </summary>
        /// <param name="rotation">The amount of rotation. [rad]</param>
        /// <param name="referencePoint">The center of rotation reference point.</param>
        /// <returns>IPathSegment.</returns>
        public Shape RotateAboutPoint(Angle rotation, CartesianCoordinate referencePoint)
        {
            _polyline  = new PolyLine(rotateSegmentsAboutPoint(rotation, referencePoint));
            _rotation += rotation;
            CartesianCoordinate newCentroid = CartesianCoordinate.RotateAboutPoint(Centroid, referencePoint, rotation.Radians);

            _translation += newCentroid - Centroid;
            return(this);
        }
Esempio n. 2
0
        /// <summary>
        /// Transforms to local.
        /// </summary>
        /// <param name="globalCoordinate">The global coordinate.</param>
        /// <returns>CartesianCoordinate.</returns>
        public CartesianCoordinate TransformToLocal(CartesianCoordinate globalCoordinate)
        {
            CartesianCoordinate rotatedCoordinate = CartesianCoordinate.RotateAboutPoint(globalCoordinate, LocalOrigin, -1 * Rotation.ToAngle().Radians);

            return(rotatedCoordinate - LocalOrigin);
        }
 /// <summary>
 /// Rotates the segment from point J.
 /// </summary>
 /// <param name="rotation">The amount of rotation. [rad]</param>
 /// <returns>IPathSegment.</returns>
 public virtual IPathSegment RotateAboutJ(Angle rotation)
 {
     return(new LineSegment(CartesianCoordinate.RotateAboutPoint(I, J, rotation.Radians), J));
 }
Esempio n. 4
0
        /// <summary>
        /// Transforms to global.
        /// </summary>
        /// <param name="localCoordinate">The local coordinate.</param>
        /// <returns>CartesianCoordinate.</returns>
        public CartesianCoordinate TransformToGlobal(CartesianCoordinate localCoordinate)
        {
            CartesianCoordinate translatedCoordinate = new CartesianCoordinate(LocalOrigin.X + localCoordinate.X, LocalOrigin.Y + localCoordinate.Y);

            return(CartesianCoordinate.RotateAboutPoint(translatedCoordinate, LocalOrigin, Rotation.ToAngle().Radians));;
        }
 /// <summary>
 /// Rotates the segment about the reference point.
 /// </summary>
 /// <param name="rotation">The amount of rotation. [rad]</param>
 /// <param name="referencePoint">The center of rotation reference point.</param>
 /// <returns>IPathSegment.</returns>
 public virtual IPathSegment RotateAboutPoint(Angle rotation, CartesianCoordinate referencePoint)
 {
     return(new LineSegment(
                CartesianCoordinate.RotateAboutPoint(I, referencePoint, rotation.Radians),
                CartesianCoordinate.RotateAboutPoint(J, referencePoint, rotation.Radians)));
 }