aboutsummaryrefslogtreecommitdiff
path: root/dep/g3dlite/include/G3D/PhysicsFrameSpline.h
blob: 75d3fea80393ec0766a044ad55eb53fbe5e20618 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
  @file PhysicsFrameSpline.h

  @author Morgan McGuire, http://graphics.cs.williams.edu
 */
#ifndef G3D_PhysicsFrameSpline_h
#define G3D_PhysicsFrameSpline_h

#include "G3D/platform.h"
#include "G3D/PhysicsFrame.h"
#include "G3D/Spline.h"

namespace G3D {

/**
 A subclass of Spline that keeps the rotation field of a
 PhysicsFrame normalized and rotating the short direction.

 \sa UprightFrameSpline
 */
class PhysicsFrameSpline : public Spline<PhysicsFrame> {
public:

    PhysicsFrameSpline();

    /** Accepts a table of properties, or any valid PhysicsFrame specification for a single control*/
    PhysicsFrameSpline(const Any& any);

    bool operator==(const PhysicsFrameSpline& a) const;
 
    bool operator!=(const PhysicsFrameSpline& a) const {
        return ! ((*this) == a);
    }

    /** Mutates all underlying PhysicsFrames by scaling their translation by \param scaleFactor */
    void scaleControlPoints(float scaleFactor);

    virtual void correct(PhysicsFrame& frame) const;
    virtual void ensureShortestPath(PhysicsFrame* A, int N) const;

    virtual Any toAny(const std::string& myName) const override {
        return Spline<PhysicsFrame>::toAny(myName);
    }

    Any toAny() const {
        return toAny("PFrameSpline");
    }
};

}

#endif