I suppose it's safest to have 3 segments per corner. 1 in the middle and 1 at each side entry point.
I suppose it's safest to have 3 segments per corner. 1 in the middle and 1 at each side entry point.
I think you didn't undersstand me correctly.
I wanna know if there is a way for me to calculate how many points that form the Catmull-rom curve do I need so that the distance between them would be in some minimum/maximum range.
I need this becouse I will be using Catmull-rom function as a guideline for creating 2d mesh for road. So if I have to litle of these pints that would be clearly visible by smal straight section that form the road cruve. And if I have to many of these ponts I'm just wasting GPU time as it will increase the number of triangles that form this 2d mesh.
In theory larger the curve the larger number of sections/curve points it requires. But how to calculate the number of these.
I only answered with way to make a curve that perfectly follows a designed game road plan. Catmull scales really well, there are no min-max and you don't need any specific spacing between them, only what your game desires. Best to test it i guess to see how it works. If you have just 1 segment in the middle of a straight, and 1 segment at the ends of it, it would (propably?) come out straight "curve" there. Just try it, see if it needs 3, 4 or 5 for long straights. Also might help if you put them near the end points.
Also to explain Catmull function to someone less familiar with it; Function takes 4 key-point parameters, and 1 float value. The float value is always in range of 0..1, and means progressive position between second and third keypoint. Sometimes calculated key-points are not looping from end to start, and so for start of a serie like that can be given the first key point twice, same for the end.
Last edited by User137; 12-09-2013 at 07:08 PM.
length of line divided by size of desired triangle
after implementing the Catmull in my own works I realize that it doesn't work quite like my bezier line routine. still I believe that a simple solution can be found
1. create a function that will convert a multi segment line into its Catmull equivalent.
2. create a function that will allow you to interpolate to any position on a multi segment line.
once you have those functions then it should be fairly easy to figure out the rest. I will try to work these out if I have some time tonight since I need them for my stuff. will post the results.
Bookmarks