예제 #1
0
        public FunctionTermCurve(FunctionTerm function)
        {
            if (function == null)
            {
                throw new ArgumentNullException("function");
            }
            if (function.DomainDimension != 1)
            {
                throw new ArgumentException("parameter 'function' has wrong domain dimension.");
            }
            if (function.CodomainDimension != 2)
            {
                throw new ArgumentException("parameter 'function' has wrong codomain dimension.");
            }

            this.point        = function;
            this.velocity     = point.GetDerivatives().Single();
            this.acceleration = velocity.GetDerivatives().Single();
            this.jerk         = acceleration.GetDerivatives().Single();

            ValueTerm position = Terms.Variable("t");

            ValueTerm speedValue = Terms.Norm(velocity.Apply(position));

            this.speed = speedValue.Abstract(position);

            ValueTerm directionValue = Terms.Angle(velocity.Apply(position));

            this.direction = directionValue.Abstract(position);

            ValueTerm curvatureValue = Terms.Quotient(direction.GetDerivatives().Single().Apply(position), speedValue);

            this.curvature = curvatureValue.Abstract(position);
        }