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

            ISolidEntity entity = HostFactory.Factory.SolidByRevolve(profile.CurveEntity, axisOrigin.PointEntity, axisDirection.IVector, startAngle, sweepAngle);

            if (entity == null)
            {
                throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "Solid.Revolve"));
            }
            return(entity);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool IsPerpendicular(Vector other)
        {
            if (other == null)
            {
                throw new System.ArgumentNullException("other");
            }
            var normalizedThis  = Normalize();
            var normalizedOther = other.Normalize();

            var dotProd = normalizedThis.Dot(normalizedOther);

            return(GeometryExtension.Equals(Math.Abs(dotProd), 0.0));
        }
Esempio n. 3
0
        internal static bool EqualsTo(this IPointEntity thisValue, IPointEntity value)
        {
            if (Object.ReferenceEquals(thisValue, value))
            {
                return(true);
            }
            if (null == thisValue || null == value)
            {
                return(false);
            }

            return(GeometryExtension.Equals(thisValue.X, value.X) && GeometryExtension.Equals(thisValue.Y, value.Y) &&
                   GeometryExtension.Equals(thisValue.Z, value.Z));
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            Vector vec = obj as Vector;

            if (null == vec)
            {
                return(false);
            }

            return(GeometryExtension.Equals(vec.X, X) && GeometryExtension.Equals(vec.Y, Y) && GeometryExtension.Equals(vec.Z, Z));
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        protected override bool Equals(DesignScriptEntity obj)
        {
            if (base.Equals(obj))
            {
                return(true);
            }

            var arc = obj as Arc;

            if (arc == null)
            {
                return(false);
            }

            return(CenterPoint.Equals(arc.CenterPoint) && Normal.Equals(arc.Normal) &&
                   GeometryExtension.Equals(Radius, arc.Radius));
        }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        protected override bool Equals(DesignScriptEntity obj)
        {
            if (base.Equals(obj))
            {
                return(true);
            }

            var other = obj as Circle;

            if (obj == null || other == null)
            {
                return(false);
            }


            return(CenterPoint.Equals(other.CenterPoint) && GeometryExtension.Equals(Radius, other.Radius) &&
                   Normal.Equals(other.Normal));
        }
Esempio n. 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        protected override bool Equals(DesignScriptEntity obj)
        {
            if (base.Equals(obj))
            {
                return(true);
            }
            var pt = obj as Point;

            if (pt == null)
            {
                return(false);
            }
            else
            {
                return(GeometryExtension.Equals(X, pt.X) && GeometryExtension.Equals(Y, pt.Y) &&
                       GeometryExtension.Equals(Z, pt.Z));
            }
        }
Esempio n. 8
0
 public static bool LessThanOrEqualTo(this Double thisValue, Double value)
 {
     return(thisValue < value || GeometryExtension.Equals(thisValue, value));
 }
Esempio n. 9
0
 public static bool EqualsTo(this Double thisValue, Double value)
 {
     return(GeometryExtension.Equals(thisValue, value));
 }
Esempio n. 10
0
 internal bool IsZeroVector()
 {
     return(GeometryExtension.Equals(X, 0.0) && GeometryExtension.Equals(Y, 0.0) && GeometryExtension.Equals(Z, 0.0));
 }