CatmullRomCurve [Commited]

Home Forum Archive Contribution Depot (jME2) CatmullRomCurve [Commited]

This topic contains 2 replies, has 3 voices, and was last updated by  dhdd 6 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #11435

    kraj0t
    0p
    Member

    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…?

    #86032

    jjmontes
    2p
    Member

    Thank you.

    #86033

    dhdd
    2p
    Participant

    well,

    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


    Index: src/com/jme/curve/CatmullRomCurve.java
    ===================================================================
    --- src/com/jme/curve/CatmullRomCurve.java   (revision 0)
    +++ src/com/jme/curve/CatmullRomCurve.java   (revision 0)
    @@ -0,0 +1,292 @@
    +package com.jme.curve;
    +
    +/*
    + * 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.
    + */
    +
    +import com.jme.curve.Curve;
    +import com.jme.intersection.CollisionResults;
    +import com.jme.intersection.PickResults;
    +import com.jme.math.FastMath;
    +import com.jme.math.Matrix3f;
    +import com.jme.math.Ray;
    +import com.jme.math.Vector3f;
    +import com.jme.scene.Spatial;
    +import com.jme.util.geom.BufferUtils;
    +
    +/**
    + * <code>CatmullRomCurve</code>
    + *
    + * @see <a href="http://www.mvps.org/directx/articles/catmull/">Catmull-Rom
    + *      Splines< /a>
    + * @author Frederik B

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘Contribution Depot (jME2)’ is closed to new topics and replies.