Esempio n. 1
0
        /// <summary>
        /// defines <see cref="aRadius"/> and <see cref="bRadius"/> by keeping the ratio of aRadius and bRadius.
        /// The arc contains the point <b>Pt</b>.
        /// </summary>
        /// <param name="Pt">Point, which lies on the new arc.</param>
        public void SetRadiusbyPoint(xy Pt)
        {
            xy     _PT = Transformation.invert() * Pt;
            double A   = _PT.length();

            Transformation = Matrix3x3.Scale(A, A) * Transformation;
            Dirty          = true;
        }
Esempio n. 2
0
        static int Succ(int i)
        {
            xy  V1     = new xy(0, 0);
            int result = i + 1;

            do
            {
                if (result == _Array1.Count)
                {
                    result = 1;
                }
                V1 = _Array1[result] - _Array1[i];
                if (V1.length() < LuckyEpsilon)
                {
                    result++;
                }
            } while (V1.length() < LuckyEpsilon);
            return(result);
        }
Esempio n. 3
0
        static int Prev(int i)
        {
            xy  V1     = new xy(0, 0);
            int result = i - 1;

            do
            {
                if (result < 0)
                {
                    result = _Array1.Count - 2;
                }
                V1 = _Array1[result] - _Array1[i];
                if (V1.length() < 0.001)
                {
                    result--;
                }
            } while (V1.dist(xy.Null) < 0.000001);
            return(result);
        }
Esempio n. 4
0
 /// <summary>
 /// This method calculates the distance to a point Pt.
 /// The parameter Lam can be taken to calculate the nearest point of the LineType, which is
 /// also returned by the outvalue Nearest
 /// </summary>
 /// <param name="Pt">Point to calculate the distance to the LineType</param>
 /// <param name="Lam">Parameter to calculate the nearest point</param>
 /// <param name="Nearest">The point on the line which has the smallest distance to Pt</param>
 /// <returns>Returns the distance from the line to the point Pt</returns>
 public double Distance(xy Pt, out double Lam, out xy Nearest)
 {
     Lam     = Direction.normalize() * (Pt - P) / Direction.length();
     Nearest = P + Direction * Lam;
     return(Nearest.dist(Pt));
 }