コード例 #1
0
    /// <summary>
    /// Adds a knot to the end of the path.
    /// </summary>
    /// <param name="NewKnot">The knot to add</param>
    public void AddKnot(Knot NewKnot)
    {
        // Add the knot to the end of the Knots list
        Knots.Add(NewKnot);

        // Regenerate the segments
        GenerateSegments();
    }
コード例 #2
0
        public override void ReadFromBinary(IBinaryReader reader)
        {
            SplineOrder = reader.ReadInt();

            var numberOfControlPoints = reader.ReadInt();

            for (var i = 0; i < numberOfControlPoints; i++)
            {
                Points.Add(reader.ReadPoint());
            }

            for (var i = 0; i < numberOfControlPoints + SplineOrder; i++)
            {
                Knots.Add(reader.ReadReal());
            }

            StartValue = reader.ReadReal();
            EndValue   = reader.ReadReal();
        }
コード例 #3
0
            internal override bool TrySetPair(DxfCodePair pair)
            {
                switch (pair.Code)
                {
                case 94:
                    Degree = pair.IntegerValue;
                    break;

                case 73:
                    IsRational = BoolShort(pair.ShortValue);
                    break;

                case 74:
                    IsPeriodic = BoolShort(pair.ShortValue);
                    break;

                case 95:
                    var _knotCount = pair.IntegerValue;
                    break;

                case 96:
                    var _controlPointCount = pair.IntegerValue;
                    break;

                case 40:
                    Knots.Add(pair.DoubleValue);
                    break;

                case 10:
                    ControlPoints.Add(new DxfControlPoint(new DxfPoint(pair.DoubleValue, 0.0, 0.0)));
                    break;

                case 20:
                    ControlPoints[ControlPoints.Count - 1] = new DxfControlPoint(ControlPoints[ControlPoints.Count - 1].Point.WithUpdatedY(pair.DoubleValue));
                    break;

                case 42:
                    ControlPoints[_currentWeight] = new DxfControlPoint(ControlPoints[_currentWeight].Point, pair.DoubleValue);
                    _currentWeight++;
                    break;

                case 97:
                    var _fitPointCount = pair.IntegerValue;
                    break;

                case 11:
                    FitPoints.Add(new DxfPoint(pair.DoubleValue, 0.0, 0.0));
                    break;

                case 21:
                    FitPoints[FitPoints.Count - 1] = FitPoints[FitPoints.Count - 1].WithUpdatedY(pair.DoubleValue);
                    break;

                case 12:
                    StartTangent = StartTangent.WithUpdatedX(pair.DoubleValue);
                    break;

                case 22:
                    StartTangent = StartTangent.WithUpdatedY(pair.DoubleValue);
                    break;

                case 13:
                    EndTangent = EndTangent.WithUpdatedX(pair.DoubleValue);
                    break;

                case 23:
                    EndTangent = EndTangent.WithUpdatedY(pair.DoubleValue);
                    break;

                default:
                    return(false);
                }

                return(true);
            }