CoordinateSystem.hh 2.35 KB
Newer Older
1 2 3 4 5
/***********************************************************************
 * Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
 * All rights reserved.                                                *
 * Distributed under the terms of the MIT License (see LICENSE.TXT).   *
 **********************************************************************/
Robert Menzel's avatar
Robert Menzel committed
6

7 8
#ifdef ACGL_INCLUDE_UNSUPPORTED

9 10 11 12 13 14 15
#ifndef ACGL_SCENE_COORDINATESYSTEM_HH
#define ACGL_SCENE_COORDINATESYSTEM_HH

/*
 * The coordinate system can be used to draw a simple grid to visualize the
 * worlds coordinate system. Drawing itself is not implemented here!
 */
Robert Menzel's avatar
Robert Menzel committed
16

Robert Menzel's avatar
Robert Menzel committed
17
#include <ACGL/ACGL.hh>
Robert Menzel's avatar
Robert Menzel committed
18 19 20 21 22
#include <ACGL/Math/Math.hh>

#include <vector>

namespace ACGL{
Robert Menzel's avatar
Robert Menzel committed
23
namespace Scene{
Robert Menzel's avatar
Robert Menzel committed
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66

class CoordinateSystem
{
public:
    CoordinateSystem(int_t outerLines = 100, int_t innerRange = 2)
    :   mOuterLines(outerLines),
        mInnerRange(innerRange),
        mInnerLines((innerRange * 2 + 1) * 10),
        mInterpolC(0.0f),
        mOuterLinesCA(mOuterLines * 2),
        mOuterLinesCB(mOuterLines * 2),
        mInnerLinesCA(mInnerLines * 2),
        mInnerLinesCB(mInnerLines * 2)
    {}
    ~CoordinateSystem() {}

    /*! Adjust the grid concerning the given absolut position */
    template<int_t A, int_t B, int_t C>
    void adjust(const glm::vec3& pos, const glm::vec3& forward);

    inline int_t getOuterLines() const { return mOuterLines; }
    inline int_t getInnerLines() const { return mInnerLines; }
    inline float getInterpolC()  const { return mInterpolC; }

    inline const std::vector<glm::vec3>& getOuterLinesCA() const { return mOuterLinesCA; }
    inline const std::vector<glm::vec3>& getOuterLinesCB() const { return mOuterLinesCB; }
    inline const std::vector<glm::vec3>& getInnerLinesCA() const { return mInnerLinesCA; }
    inline const std::vector<glm::vec3>& getInnerLinesCB() const { return mInnerLinesCB; }

    inline float getInnerMetric() { return mInnerMetric; }

private:
    int_t                  mOuterLines;
    int_t                  mInnerRange;
    int_t                  mInnerLines;
    float                  mInterpolC;
    std::vector<glm::vec3> mOuterLinesCA;
    std::vector<glm::vec3> mOuterLinesCB;
    std::vector<glm::vec3> mInnerLinesCA;
    std::vector<glm::vec3> mInnerLinesCB;
    float                  mInnerMetric;
};

Robert Menzel's avatar
Robert Menzel committed
67
} // Scene
Robert Menzel's avatar
Robert Menzel committed
68 69
} // ACGL

70
#endif // ACGL_SCENE_COORDINATESYSTEM_HH
71 72

#endif