Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

How can I add new point to Spline.ControlPoints? #470

Open
jim-jiang-github opened this issue Aug 1, 2023 · 2 comments
Open

How can I add new point to Spline.ControlPoints? #470

jim-jiang-github opened this issue Aug 1, 2023 · 2 comments
Labels

Comments

@jim-jiang-github
Copy link

Spline.ControlPoints is a Array, and only Support getter no setter. How can I add new point to Spline.ControlPoints? Can only re-instantiate an object? If you re-instantiate an object, what parameters do you need to pass to Spline besides ControlPoints?

@haplokuon
Copy link
Owner

You can use the Spline constructor
public Spline(IEnumerable<Vector3> controlPoints, IEnumerable<double> weights, short degree, bool closedPeriodic)

As the "controlPoints" parameter pass your new array of Vector3 that represents your new control points list.
As the "weights" parameter you can just pass null if you use the default value of one for the weights vector or you just do not know what is the purpose of it. If you do, you already know what to do with it.
As the "degree" parameter pass the value of the property Degree of your previous spline.
As the "closedPeriodic" parameter pass the value of the property IsClosedPeriodic of your previous spline.

@jim-jiang-github
Copy link
Author

You can use the Spline constructor public Spline(IEnumerable<Vector3> controlPoints, IEnumerable<double> weights, short degree, bool closedPeriodic)

As the "controlPoints" parameter pass your new array of Vector3 that represents your new control points list. As the "weights" parameter you can just pass null if you use the default value of one for the weights vector or you just do not know what is the purpose of it. If you do, you already know what to do with it. As the "degree" parameter pass the value of the property Degree of your previous spline. As the "closedPeriodic" parameter pass the value of the property IsClosedPeriodic of your previous spline.

Thank you very much.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants