Catmull-Rom-Splines | Catmull-Rom spline implementation in Unity | Game Engine library
kandi X-RAY | Catmull-Rom-Splines Summary
kandi X-RAY | Catmull-Rom-Splines Summary
Organized catmull rom spline implementation in Unity. Spline logic is in its own data structure; Catmull Points (Position, Normal, Tangent) is its own struct. I cleaned up the code from my Road Generator repository, since that was... best not to mention it. If you use it anywhere give me a ping on noobstudiosunity @ gmail.com.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Catmull-Rom-Splines
Catmull-Rom-Splines Key Features
Catmull-Rom-Splines Examples and Code Snippets
Community Discussions
Trending Discussions on Catmull-Rom-Splines
QUESTION
I am trying to generate a Catmull-Rom curve from a list of points in Unity. As I do not want to store points in between points of the curve I opted to use a solution that could calculate a position in a Catmull-Rom curve based on time. There are a few examples of this, here and here, however, neither shows how to implement alpha.
The reason I want to implement alpha is so I can have the ability to change between a centripetal, chordal, and uniform Catmull-Rom curve.
...ANSWER
Answered 2018-Jun-03 at 15:42To anyone who comes here, the answer actually comes from the maths in one of the links from the original question. It is an answer from an SO question Catmull-rom curve with no cusps and no self-intersections . So credits to cfh.
The code posted in my original question is a great way to calculate points in a uniform Catmull-Rom spline, however, it did not factor in alpha. Therefore, it could not be used for chordal, or centripetal, (or anything in between) Catmull-Rom splines. The code below does take into account alpha and therefore supports both chordal and centripetal Catmull-Rom splines.
Without further ado, here is the code ported into C# for Unity.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Catmull-Rom-Splines
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page