Exemple #1
0
        /// <summary>
        /// Constructs a new AKT_Line segment from start point, direction and length.
        /// </summary>
        /// <param name="start">Start point of AKT_Line segment.</param>
        /// <param name="direction">Direction of AKT_Line segment.</param>
        /// <param name="length">Length of AKT_Line segment.</param>
        public AKT_Line(AKT_Point3d start, AKT_Vector3d direction, double length)
        {
            AKT_Vector3d vector3d = direction;

            if (!vector3d.Unitize())
            {
                vector3d = new AKT_Vector3d(0, 0, 1);
            }
            this.m_from = start;
            this.m_to   = start + (vector3d * length);
        }
Exemple #2
0
        /// <summary>
        /// Gets the unit tangent vector along the AKT_PolyLine at the given parameter.
        /// The integer part of the parameter indicates the index of the segment.
        /// </summary>
        /// <param name="t">AKT_PolyLine parameter.</param>
        /// <returns>The tangent along the AKT_PolyLine at t.</returns>
        public AKT_Vector3d TangentAt(double t)
        {
            int count = this.points.Count();

            if (count < 2)
            {
                return(AKT_Vector3d.Zero);
            }
            int num = (int)Math.Floor(t);

            if (num < 0)
            {
                num = 0;
            }
            else if (num > count - 2)
            {
                num = count - 2;
            }
            AKT_Vector3d mItems = this.points[num + 1] - this.points[num];

            mItems.Unitize();
            return(mItems);
        }