Exemplo n.º 1
0
        /// <summary>
        /// Creates an arc by tree points P,Q and R.
        /// </summary>
        /// <param name="P">First point</param>
        /// <param name="Q">Second point</param>
        /// <param name="R">Third point</param>
        public Arc(xy P, xy Q, xy R)
        {
            LineType2d L1 = new LineType2d((P + Q) * 0.5, (Q - P).normal());
            LineType2d L2 = new LineType2d((Q + R) * 0.5, (R - Q).normal());
            double     Lam, Mue;

            if (L1.Cross(L2, out Lam, out Mue))
            {
                Center    = L1.Value(Lam);
                aRadius   = bRadius = Center.dist(P);
                Alfa      = getAngle(P);
                Beta      = getAngle(R);
                ClockWise = ((R - Q) & (P - Q)) < 0;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Overrides the <see cref="Curve.setAtang"/>-method
 /// </summary>
 /// <param name="value">starttangent</param>
 protected override void setAtang(xy value)
 {
     _At         = value;
     atangSetted = true;
     if (btangSetted)
     {
         double     lam, mue;
         LineType2d l1 = new LineType2d(A, value);
         LineType2d l2 = new LineType2d(B, _Bt);
         if (l1.Cross(l2, out lam, out mue))
         {
             ControlPoint = l1.Value(lam);
         }
         Dirty = true;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Overrides the <see cref="Curve.Slice"/>-method.
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        public override void Slice(double from, double to)
        {
            xy T1 = Derivation(from).normalize();
            xy T2 = Derivation(to).normalize();
            xy _A = Value(from);
            xy _B = Value(to);

            if ((System.Math.Abs(T1 & T2) < 0.001)
                ||
                (System.Math.Abs(from - to) < 0.001))
            {
                ControlPoint = (_A + _B) * 0.5;
                A            = _A;
                B            = _B;
                Dirty        = true;
                return;
            }
            LineType2d L1  = new LineType2d(_A, Derivation(from));
            LineType2d L2  = new LineType2d(_B, Derivation(to));
            double     Lam = -1;
            double     Mue = -1;

            L1.Cross(L2, out Lam, out Mue);
            xy     Halbierung    = (_A + _B) * 0.5;
            xy     P1            = Value((from + to) * 0.5);
            xy     _ControlPoint = L1.Value(Lam);
            double a             = (P1 - Halbierung).length();
            double b             = (_ControlPoint - Halbierung).length();

            Weight = a / (b - a);
            if (Weight < 0)
            {
            }
            A            = _A;
            B            = _B;
            ControlPoint = _ControlPoint;
            Dirty        = true;
        }