October 1, 2008 at 13:46 #11435
you can see the original post here -> http://www.jmonkeyengine.com/jmeforum/index.php?topic=4077.0
[Credits to Gaheris and dhdd for this implementation]
The class is already well implemented, and tested. No possible bugs that I can think of. I will need this for my project, so I decided to upload it to the repository. It would be a nice addition to the engine.
These curves are really helpful. As an example: I will be using this for pathfinding. I'll express the chosen paths via instances of Vector3f representing the positions. Then, by calculating a Catmull-Rom curve with those positions as input, the agents of the game will move smoothly, no rigid turns ;)
Of course, this would fall under the com.jme.curve package.
Maybe it needs to be a little polished…?October 1, 2008 at 20:04 #86032
Thank you.October 3, 2008 at 12:51 #86033
here it is, the CRC and Test class Patch:
The class TestCatmullRomCurve is the same as TestBezierCurve. I think its best because new members can easily see the main difference between those two fine curves I'll check it in after 48 hours
--- src/com/jme/curve/CatmullRomCurve.java (revision 0)
+++ src/com/jme/curve/CatmullRomCurve.java (revision 0)
@@ -0,0 +1,292 @@
+ * Copyright (c) 2003-2008 jMonkeyEngine
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * <code>CatmullRomCurve</code>
+ * @see <a href="http://www.mvps.org/directx/articles/catmull/">Catmull-Rom
+ * Splines< /a>
+ * @author Frederik B
The forum ‘Contribution Depot (jME2)’ is closed to new topics and replies.