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); }
public FunctionTermCurve InstantiateParameter(ValueTerm parameter) { ValueTerm position = Terms.Variable("t"); return(new FunctionTermCurve(function.Apply(position, parameter).Abstract(position))); }
public FunctionTermCurve TransformInput(FunctionTerm transformation) { ValueTerm position = Terms.Variable("t"); return(new FunctionTermCurve(point.Apply(transformation.Apply(position)).Abstract(position))); }
static Vector2Double EvaluateVector(FunctionTerm function, double value) { IEnumerable <double> result = function.Apply(Terms.Constant(value)).Evaluate(); return(new Vector2Double(result.ElementAt(0), result.ElementAt(1))); }
static double EvaluateScalar(FunctionTerm function, double value) { IEnumerable <double> result = function.Apply(Terms.Constant(value)).Evaluate(); return(result.Single()); }
public bool Contains(double position) { double localPosition = positionTransformation.Apply(Terms.Constant(position)).Evaluate().Single(); return(new OrderedRange <double>(0, 1).Contains(localPosition)); }
public static ValueTerm Apply(this FunctionTerm function, params ValueTerm[] parameters) { return(function.Apply((IEnumerable <ValueTerm>)parameters)); }