Esempio n. 1
0
        private static ISolidEntity RevolveCore(DSCurve profile, DSLine axis, double startAngle, double sweepAngle)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }
            if (axis == null)
            {
                throw new ArgumentNullException("axis");
            }
            if (!profile.IsPlanar)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "profile"), "profile");
            }
            if (DSGeometryExtension.Equals(axis.Length, 0.0))
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "axisDirection"), "axisDirection");
            }
            if (DSGeometryExtension.Equals(sweepAngle, 0.0))
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "sweepAngle"), "sweepAngle");
            }

            ISolidEntity entity = HostFactory.Factory.SolidByRevolve(profile.CurveEntity, axis.StartPoint.PointEntity, axis.Direction.IVector, startAngle, sweepAngle);

            if (entity == null)
            {
                throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "DSSolid.Revolve"));
            }
            return(entity);
        }
Esempio n. 2
0
        /// <summary>
        /// Checks whether input lines are parallel.
        /// </summary>
        /// <param name="otherLine"></param>
        /// <returns></returns>
        public bool IsParallel(DSLine otherLine)
        {
            if (null == otherLine)
            {
                return(false);
            }

            return(Direction.IsParallel(otherLine.Direction));
        }
Esempio n. 3
0
        /// <summary>
        /// Checks whether input lines are colinear
        /// </summary>
        /// <param name="otherLine"></param>
        /// <returns></returns>
        public bool IsColinear(DSLine otherLine)
        {
            if (!IsParallel(otherLine))
            {
                return(false);
            }

            IPointEntity[] endpts = { StartPoint.PointEntity, EndPoint.PointEntity, otherLine.StartPoint.PointEntity };
            return(endpts.ArePointsColinear());
        }
Esempio n. 4
0
 protected DSSolid(DSCurve profile, DSLine axis, double startAngle, double sweepAngle, bool persist)
     : base(RevolveCore(profile, axis, startAngle, sweepAngle), persist)
 {
     InitializeGuaranteedProperties();
     Profile = profile;
     AxisOrigin = axis.StartPoint;
     AxisDirection = axis.Direction;
     Axis = axis;
     StartAngle = startAngle;
     SweepAngle = sweepAngle;
 }
 protected DSRevolvedSurface(DSCurve profile, DSLine axis, double startAngle, double sweepAngle, bool persist)
     : base(ByProfileAxisAngleCore(profile, axis, startAngle, sweepAngle), persist)
 {
     InitializeGuaranteedProperties();
     Profile       = profile;
     AxisOrigin    = axis.StartPoint;
     AxisDirection = axis.Direction;
     StartAngle    = startAngle;
     SweepAngle    = sweepAngle;
     Axis          = axis;
 }
Esempio n. 6
0
        private static IConeEntity ByCenterLineRadiusCore(DSLine centerLine, double startRadius, double endRadius)
        {
            if (null == centerLine)
            {
                throw new System.ArgumentNullException("centerLine");
            }

            IConeEntity entity = ByStartPointEndPointRadiusCore(centerLine.StartPoint, centerLine.EndPoint, startRadius, endRadius);

            return(entity);
        }
Esempio n. 7
0
        internal static DSLine[] CreateEdges(DSPoint[] points)
        {
            int nCount = points.Length;

            DSLine[] edges = new DSLine[nCount];
            for (int i = 0; i < nCount - 1; ++i)
            {
                edges[i] = new DSLine(points[i], points[i + 1], false);
            }

            edges[nCount - 1] = new DSLine(points[nCount - 1], points[0], false);
            return(edges);
        }
        private static ISurfaceEntity ByProfileAxisAngleCore(DSCurve profile, DSLine axis, double startAngle, double sweepAngle)
        {
            if (null == axis)
            {
                throw new System.ArgumentNullException("axis");
            }
            ISurfaceEntity surf = ByProfileAxisOriginDirectionAngleCore(profile, axis.StartPoint, axis.Direction, startAngle, sweepAngle);

            if (null == surf)
            {
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSRevolvedSurface.ByProfileAxisAngle"));
            }
            return(surf);
        }
Esempio n. 9
0
 /// <summary>
 /// Constructs a Solid by revolving  a closed profile curve about an axis defined by a line axis. Assuming sweep angle = 360 and start angle = 0.
 /// </summary>
 /// <param name="profile">The closed profile to be swept</param>
 /// <param name="axis">the input axis</param>
 /// <returns></returns>
 public static DSSolid Revolve(DSCurve profile, DSLine axis)
 {
     return(new DSSolid(profile, axis, 0, 360, true));
 }
Esempio n. 10
0
        /// <summary>
        /// Checks whether input lines are parallel.
        /// </summary>
        /// <param name="otherLine"></param>
        /// <returns></returns>
        public bool IsParallel(DSLine otherLine)
        {
            if (null == otherLine)
                return false;

            return Direction.IsParallel(otherLine.Direction);
        }
Esempio n. 11
0
        private static IConeEntity ByCenterLineRadiusCore(DSLine centerLine, double startRadius, double endRadius)
        {
            if (null == centerLine)
                throw new System.ArgumentNullException("centerLine");

            IConeEntity entity = ByStartPointEndPointRadiusCore(centerLine.StartPoint, centerLine.EndPoint, startRadius, endRadius);
            return entity;
        }
Esempio n. 12
0
 /// <summary>
 /// Construct a Surface by revolving curve about a line axis. Assuming
 /// sweep angle = 360 and start angle = 0.
 /// </summary>
 /// <param name="profile">Profile Curve for revolve surface.</param>
 /// <param name="axis">Line to define axis of revolution.</param>
 /// <returns>SRevolvedSurface</returns>
 public static DSRevolvedSurface Revolve(DSCurve profile, DSLine axis)
 {
     return(DSRevolvedSurface.ByProfileAxis(profile, axis));
 }
Esempio n. 13
0
 /// <summary>
 /// Construct a Surface by revolving  curve about a line axis. startAngle 
 /// determines where the curve starts to revolve, sweepAngle determines 
 /// the revolving angle.
 /// </summary>
 /// <param name="profile">Profile Curve for revolve surface.</param>
 /// <param name="axis">Line to define axis of revolution.</param>
 /// <param name="startAngle">Start Angle in degreee at which curve starts to revolve.</param>
 /// <param name="sweepAngle">Sweep Angle in degree to define the extent of revolve.</param>
 /// <returns>RevolvedSurface</returns>
 public static DSRevolvedSurface Revolve(DSCurve profile, DSLine axis, double startAngle, double sweepAngle)
 {
     return DSRevolvedSurface.ByProfileAxisAngle(profile, axis, startAngle, sweepAngle);
 }
Esempio n. 14
0
 protected DSCone(DSLine centerLine, double startRadius, double endRadius, bool persist)
     : base(ByCenterLineRadiusCore(centerLine, startRadius, endRadius), persist)
 {
     InitializeGuaranteedProperties();
     CenterLine = centerLine;
 }
Esempio n. 15
0
 /// <summary>
 /// Construct a Surface by revolving curve about a line axis. Assuming
 /// sweep angle = 360 and start angle = 0.
 /// </summary>
 /// <param name="profile">Profile Curve for revolve surface.</param>
 /// <param name="axis">Line to define axis of revolution.</param>
 /// <returns>Surface of revolution.</returns>
 public static DSRevolvedSurface ByProfileAxis(DSCurve profile, DSLine axis)
 {
     return(new DSRevolvedSurface(profile, axis, 0, 360, true));
 }
Esempio n. 16
0
 /// <summary>
 /// Constructs a Solid by revolving  a closed profile curve about an axis defined by a line axis. Assuming sweep angle = 360 and start angle = 0.
 /// </summary>
 /// <param name="profile">The closed profile to be swept</param>
 /// <param name="axis">the input axis</param>
 /// <returns></returns>
 public static DSSolid Revolve(DSCurve profile, DSLine axis)
 {
     return new DSSolid(profile, axis, 0, 360, true);
 }
Esempio n. 17
0
 /// <summary>
 /// Constructs a Solid by revolving  a closed profile curve about an axis defined by a line axis. 
 /// </summary>
 /// <param name="profile">The closed profile to be swept</param>
 /// <param name="axis">the input axis</param>
 /// <param name="startAngle">startAngle determines where the curve starts to revolve</param>
 /// <param name="sweepAngle">sweepAngle determines the revolving angle.</param>
 /// <returns></returns>
 public static DSSolid Revolve(DSCurve profile, DSLine axis, double startAngle, double sweepAngle)
 {
     return new DSSolid(profile, axis, startAngle, sweepAngle, true);
 }
Esempio n. 18
0
 private static ISurfaceEntity ByProfileAxisAngleCore(DSCurve profile, DSLine axis, double startAngle, double sweepAngle)
 {
     if (null == axis)
         throw new System.ArgumentNullException("axis");
     ISurfaceEntity surf = ByProfileAxisOriginDirectionAngleCore(profile, axis.StartPoint, axis.Direction, startAngle, sweepAngle);
     if (null == surf)
         throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSRevolvedSurface.ByProfileAxisAngle"));
     return surf;
 }
Esempio n. 19
0
 /// <summary>
 /// Construct a Surface by revolving curve about a line axis. Assuming 
 /// sweep angle = 360 and start angle = 0.
 /// </summary>
 /// <param name="profile">Profile Curve for revolve surface.</param>
 /// <param name="axis">Line to define axis of revolution.</param>
 /// <returns>Surface of revolution.</returns>
 public static DSRevolvedSurface ByProfileAxis(DSCurve profile, DSLine axis)
 {
     return new DSRevolvedSurface(profile, axis, 0, 360, true);
 }
Esempio n. 20
0
        private static ISolidEntity RevolveCore(DSCurve profile, DSLine axis, double startAngle, double sweepAngle)
        {
            if (profile == null)
                throw new ArgumentNullException("profile");
            if (axis == null)
                throw new ArgumentNullException("axis");
            if (!profile.IsPlanar)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "profile"), "profile");
            if (DSGeometryExtension.Equals(axis.Length, 0.0))
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "axisDirection"), "axisDirection");
            if (DSGeometryExtension.Equals(sweepAngle, 0.0))
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "sweepAngle"), "sweepAngle");

            ISolidEntity entity = HostFactory.Factory.SolidByRevolve(profile.CurveEntity, axis.StartPoint.PointEntity, axis.Direction.IVector, startAngle, sweepAngle);
            if (entity == null)
                throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "DSSolid.Revolve"));
            return entity;
        }
Esempio n. 21
0
        /// <summary>
        /// def RevolveAsSolid : Solid (axis : Line, startAngle : double, sweepAngle : double)
        /// 
        /// Returns a Solid by revolving the closed curve about a given axis 
        /// line. startAngle determines where the curve starts to revolve, 
        /// sweepAngle determines the revolving angle.
        /// </summary>
        /// <param name="axis">Line curve as axis of revolution</param>
        /// <param name="startAngle">Start angle in degrees</param>
        /// <param name="sweepAngle">Sweep angle for rotation in degrees</param>
        /// <returns>Revolved Solid</returns>
        public DSSolid RevolveAsSolid(DSLine axis, double startAngle, double sweepAngle)
        {
            if (!IsClosed)
                throw new System.InvalidOperationException(Properties.Resources.CurveNotClosed);
            else if (!IsPlanar)
                throw new System.InvalidOperationException(Properties.Resources.CurveNotPlanar);
            else if (axis == null)
                throw new System.ArgumentNullException("axis");
            else if (axis.Length.EqualsTo(0.0))
                throw new System.ArgumentException(string.Format(Properties.Resources.IsZeroLength, "axis length"), "axis");

            return DSSolid.Revolve(this, axis, startAngle, sweepAngle);
        }
Esempio n. 22
0
 /// <summary>
 /// Construct a Surface by revolving curve about a line axis. Assuming 
 /// sweep angle = 360 and start angle = 0.
 /// </summary>
 /// <param name="profile">Profile Curve for revolve surface.</param>
 /// <param name="axis">Line to define axis of revolution.</param>
 /// <returns>SRevolvedSurface</returns>
 public static DSRevolvedSurface Revolve(DSCurve profile, DSLine axis)
 {
     return DSRevolvedSurface.ByProfileAxis(profile, axis);
 }
Esempio n. 23
0
 /// <summary>
 /// def RevolveAsSolid : Solid (axis : Line)
 /// 
 /// Returns a Solid by revolving the closed curve about a given axis 
 /// line by 360 revolution.
 /// </summary>
 /// <param name="axis">Line curve as axis of revolution</param>
 /// <returns>Revolved Solid</returns>
 public DSSolid RevolveAsSolid(DSLine axis)
 {
     return RevolveAsSolid(axis, 0.0, 360.0);
 }
Esempio n. 24
0
 /// <summary>
 /// Constructs a solid cone defined by a line the start and end radii of its base and top respectively.
 /// </summary>
 /// <param name="centerLine">The center line of the cone</param>
 /// <param name="startRadius">The radius of the base of the cone</param>
 /// <param name="endRadius">The radius of the top of the cone</param>
 /// <returns></returns>
 public static DSCone ByCenterLineRadius(DSLine centerLine, double startRadius, double endRadius)
 {
     return(new DSCone(centerLine, startRadius, endRadius, true));
 }
Esempio n. 25
0
        /// <summary>
        /// def RevolveAsSurface : Surface (axis : Line, startAngle : double, sweepAngle : double)
        /// 
        /// Returns a Surface by revolving this curve about a line axis. 
        /// startAngle determines where the curve starts to revolve, sweepAngle
        /// determines the revolving angle.
        /// </summary>
        /// <param name="axis">Line curve as axis of revolution</param>
        /// <param name="startAngle">Start angle in degrees</param>
        /// <param name="sweepAngle">Sweep angle for rotation in degrees</param>
        /// <returns>Revolved Surface</returns>
        public DSSurface RevolveAsSurface(DSLine axis, double startAngle, double sweepAngle)
        {
            if (axis == null)
                throw new System.ArgumentNullException("axis");
            else if (axis.Length.EqualsTo(0.0))
                throw new System.ArgumentException(Properties.Resources.IsZeroLength, "axis");
            else if (sweepAngle.EqualsTo(0.0))
                throw new System.ArgumentException(string.Format(Properties.Resources.IsZeroAngle, "sweep"), "sweepAngle");

            return DSSurface.Revolve(this, axis, startAngle, sweepAngle);
        }
Esempio n. 26
0
 /// <summary>
 /// Construct a Surface by revolving  curve about a line axis. startAngle
 /// determines where the curve starts to revolve, sweepAngle determines
 /// the revolving angle.
 /// </summary>
 /// <param name="profile">Profile Curve for revolve surface.</param>
 /// <param name="axis">Line to define axis of revolution.</param>
 /// <param name="startAngle">Start Angle in degreee at which curve starts to revolve.</param>
 /// <param name="sweepAngle">Sweep Angle in degree to define the extent of revolve.</param>
 /// <returns>RevolvedSurface</returns>
 public static DSRevolvedSurface Revolve(DSCurve profile, DSLine axis, double startAngle, double sweepAngle)
 {
     return(DSRevolvedSurface.ByProfileAxisAngle(profile, axis, startAngle, sweepAngle));
 }
Esempio n. 27
0
        /// <summary>
        /// def RevolveAsSurface : Surface (axis : Line)
        /// 
        /// Returns a Surface by revolving this curve about a line axis. 
        /// Assuming sweep angle = 360 and start angle = 0.
        /// </summary>
        /// <param name="axis">Line curve as axis of revolution</param>
        /// <returns>Revolved Surface</returns>
        public DSSurface RevolveAsSurface(DSLine axis)
        {
            if (axis == null)
                throw new System.ArgumentNullException("axis");
            else if (axis.Length.EqualsTo(0.0))
                throw new System.ArgumentException(Properties.Resources.IsZeroLength, "axis");

            return DSSurface.Revolve(this, axis);
        }
Esempio n. 28
0
 /// <summary>
 /// Constructs a solid cone defined by a line the start and end radii of its base and top respectively.
 /// </summary>
 /// <param name="centerLine">The center line of the cone</param>
 /// <param name="startRadius">The radius of the base of the cone</param>
 /// <param name="endRadius">The radius of the top of the cone</param>
 /// <returns></returns>
 public static DSCone ByCenterLineRadius(DSLine centerLine, double startRadius, double endRadius)
 {
     return new DSCone(centerLine, startRadius, endRadius, true);
 }
Esempio n. 29
0
 /// <summary>
 /// Constructs a Solid by revolving  a closed profile curve about an axis defined by a line axis.
 /// </summary>
 /// <param name="profile">The closed profile to be swept</param>
 /// <param name="axis">the input axis</param>
 /// <param name="startAngle">startAngle determines where the curve starts to revolve</param>
 /// <param name="sweepAngle">sweepAngle determines the revolving angle.</param>
 /// <returns></returns>
 public static DSSolid Revolve(DSCurve profile, DSLine axis, double startAngle, double sweepAngle)
 {
     return(new DSSolid(profile, axis, startAngle, sweepAngle, true));
 }
Esempio n. 30
0
 protected DSCone(DSLine centerLine, double startRadius, double endRadius, bool persist)
     : base(ByCenterLineRadiusCore(centerLine, startRadius, endRadius), persist)
 {
     InitializeGuaranteedProperties();
     CenterLine = centerLine;
 }
Esempio n. 31
0
        /// <summary>
        /// Checks whether input lines are colinear
        /// </summary>
        /// <param name="otherLine"></param>
        /// <returns></returns>
        public bool IsColinear(DSLine otherLine)
        {
            if (!IsParallel(otherLine))
                return false;

            IPointEntity[] endpts = { StartPoint.PointEntity, EndPoint.PointEntity, otherLine.StartPoint.PointEntity};
            return endpts.ArePointsColinear();
        }