Orbit orbit;
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong semi-major axis on default orbit",
Orbit orbit;
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong semi-major axis on default orbit",
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong eccentricity on default orbit",
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong eccentricity on default orbit",
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong inclination on default orbit",
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong inclination on default orbit",
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong longitude of ascending node on default orbit",
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong longitude of ascending node on default orbit",
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong argument of periapsis on default orbit",
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong argument of periapsis on default orbit",
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong mean anomaly on default orbit",
);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong mean anomaly on default orbit",
);
// reference direction is +X, so at t=0, the body should be
// at (sma,0,0) relative to its parent
);
// reference direction is +X, so at t=0, the body should be
// at (sma,0,0) relative to its parent
- glm::vec4 pos(orbit.Matrix(0.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ glm::dvec4 pos(orbit.Matrix(0.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0));
- glm::vec3(1.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(1.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
- pos = orbit.Matrix(PI * 0.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 0.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, -1.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, -1.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(-1.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(-1.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 1.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 1.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 1.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 1.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 360° position should be (sma,0,0), the initial position
);
// at 360° position should be (sma,0,0), the initial position
- pos = orbit.Matrix(PI * 2.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 2.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(1.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(1.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
Orbit orbit;
orbit.SemiMajorAxis(2.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong semi-major axis on orbit",
Orbit orbit;
orbit.SemiMajorAxis(2.0);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong semi-major axis on orbit",
);
// reference direction is +X, so at t=0, the body should be
// at (sma,0,0) relative to its parent
);
// reference direction is +X, so at t=0, the body should be
// at (sma,0,0) relative to its parent
- glm::vec4 pos(orbit.Matrix(0.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ glm::dvec4 pos(orbit.Matrix(0.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0));
- glm::vec3(2.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(2.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
- pos = orbit.Matrix(PI * 0.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 0.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, -2.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, -2.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(-2.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(-2.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 1.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 1.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 2.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 2.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 360° position should be (sma,0,0), the initial position
);
// at 360° position should be (sma,0,0), the initial position
- pos = orbit.Matrix(PI * 2.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 2.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(2.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(2.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
Orbit orbit;
orbit.Eccentricity(0.5);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong eccentricity on orbit",
Orbit orbit;
orbit.Eccentricity(0.5);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong eccentricity on orbit",
- glm::vec4 pos(orbit.Matrix(0.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ glm::dvec4 pos(orbit.Matrix(0.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0));
- glm::vec3(0.5f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.5, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 0.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 0.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(-0.935130834579468f, 0.0f, -0.779740869998932f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(-0.93513085903671, 0.0, -0.779740887497559),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(-1.5f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(-1.5, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 1.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 1.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(-0.935130834579468f, 0.0f, 0.779740869998932f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(-0.93513085903671, 0.0, 0.779740887497559),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 2.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 2.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.5f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.5, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
Orbit orbit;
orbit.Inclination(PI * 0.25); // 45°
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong inclination on orbit",
Orbit orbit;
orbit.Inclination(PI * 0.25); // 45°
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong inclination on orbit",
);
// inclination rotates counter clockwise around +X, so at t=0 should be
// at (sma,0,0) relative to its parent
);
// inclination rotates counter clockwise around +X, so at t=0 should be
// at (sma,0,0) relative to its parent
- glm::vec4 pos(orbit.Matrix(0.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ glm::dvec4 pos(orbit.Matrix(0.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0));
- glm::vec3(1.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(1.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 0.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 0.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.70710676908493f, -0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.707106781186548, -0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(-1.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(-1.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 1.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 1.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, -0.70710676908493f, 0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, -0.707106781186548, 0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 2.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 2.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(1.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(1.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
Orbit orbit;
orbit.LongitudeAscending(PI * 0.25); // 45°
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong longitude of ascending node on orbit",
Orbit orbit;
orbit.LongitudeAscending(PI * 0.25); // 45°
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong longitude of ascending node on orbit",
);
// using an inclination of 90° as well to make the rotation more apparent
orbit.Inclination(PI * 0.5);
// inclination rotates counter clockwise around +X, while LAN rotates it
// around +Y, so at t=0 should be at (sma*sin(45°),0,-sma*cos(45°))
);
// using an inclination of 90° as well to make the rotation more apparent
orbit.Inclination(PI * 0.5);
// inclination rotates counter clockwise around +X, while LAN rotates it
// around +Y, so at t=0 should be at (sma*sin(45°),0,-sma*cos(45°))
- glm::vec4 pos(orbit.Matrix(0.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ glm::dvec4 pos(orbit.Matrix(0.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0));
- glm::vec3(0.70710676908493f, 0.0f, -0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.707106781186548, 0.0, -0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 0.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 0.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 1.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 1.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(-0.70710676908493f, 0.0f, 0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(-0.707106781186548, 0.0, 0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 1.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 1.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, -1.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, -1.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 2.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 2.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.70710676908493f, 0.0f, -0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.707106781186548, 0.0, -0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
Orbit orbit;
orbit.ArgumentPeriapsis(PI * 0.25); // 45°
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong argument of periapsis node on orbit",
Orbit orbit;
orbit.ArgumentPeriapsis(PI * 0.25); // 45°
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong argument of periapsis node on orbit",
);
// using an inclination of 90° as well to make the rotation more apparent
orbit.Inclination(PI * 0.5);
);
// using an inclination of 90° as well to make the rotation more apparent
orbit.Inclination(PI * 0.5);
// inclination rotates counter clockwise around +X, while APe rotates it
// around +Y in the rotated coordinate system, so at t=0 should be at
// (sma*sin(45°),0,sma*cos(45°))
// inclination rotates counter clockwise around +X, while APe rotates it
// around +Y in the rotated coordinate system, so at t=0 should be at
// (sma*sin(45°),0,sma*cos(45°))
- glm::vec4 pos(orbit.Matrix(0.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ glm::dvec4 pos(orbit.Matrix(0.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0));
- glm::vec3(0.70710676908493f, 0.0f, 0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.707106781186548, 0.0, 0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 0.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 0.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 1.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 1.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(-0.70710676908493f, 0.0f, -0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(-0.707106781186548, 0.0, -0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 1.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 1.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, -1.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, -1.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 2.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 2.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.70710676908493f, 0.0f, 0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.707106781186548, 0.0, 0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
Orbit orbit;
orbit.MeanAnomaly(PI * 0.25); // 45°
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong mean anomaly on default orbit",
Orbit orbit;
orbit.MeanAnomaly(PI * 0.25); // 45°
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"wrong mean anomaly on default orbit",
- glm::vec4 pos(orbit.Matrix(0.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f));
+ glm::dvec4 pos(orbit.Matrix(0.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0));
- glm::vec3(0.70710676908493f, 0.0f, -0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.707106781186548, 0.0, -0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
- pos = orbit.Matrix(PI * 0.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 0.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(-0.70710676908493f, 0.0f, -0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(-0.707106781186548, 0.0, -0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(-0.70710676908493f, 0.0f, 0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(-0.707106781186548, 0.0, 0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.Matrix(PI * 1.5) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 1.5) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.70710676908493f, 0.0f, 0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.707106781186548, 0.0, 0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 360° position should be (sma,0,0), the initial position
);
// at 360° position should be (sma,0,0), the initial position
- pos = orbit.Matrix(PI * 2.0) * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.Matrix(PI * 2.0) * glm::dvec4(0.0, 0.0, 0.0, 1.0);
- glm::vec3(0.70710676908493f, 0.0f, -0.70710676908493f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.707106781186548, 0.0, -0.707106781186548),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- glm::vec4 pos(orbit.InverseMatrix(0.0) * glm::vec4(1.0f, 0.0f, 0.0f, 1.0f));
+ glm::dvec4 pos(orbit.InverseMatrix(0.0) * glm::dvec4(1.0, 0.0, 0.0, 1.0));
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
- pos = orbit.InverseMatrix(PI * 0.5) * glm::vec4(0.0f, 0.0f, -1.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 0.5) * glm::dvec4(0.0, 0.0, -1.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI) * glm::vec4(-1.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI) * glm::dvec4(-1.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 1.5) * glm::vec4(0.0f, 0.0f, 1.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 1.5) * glm::dvec4(0.0, 0.0, 1.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 360° position should be (sma,0,0), the initial position
);
// at 360° position should be (sma,0,0), the initial position
- pos = orbit.InverseMatrix(PI * 2.0) * glm::vec4(1.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 2.0) * glm::dvec4(1.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
Orbit orbit;
orbit.SemiMajorAxis(2.0);
// reference direction is +X, so at t=0, the body should be
// at (sma,0,0) relative to its parent
Orbit orbit;
orbit.SemiMajorAxis(2.0);
// reference direction is +X, so at t=0, the body should be
// at (sma,0,0) relative to its parent
- glm::vec4 pos(orbit.InverseMatrix(0.0) * glm::vec4(2.0f, 0.0f, 0.0f, 1.0f));
+ glm::dvec4 pos(orbit.InverseMatrix(0.0) * glm::dvec4(2.0, 0.0, 0.0, 1.0));
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
- pos = orbit.InverseMatrix(PI * 0.5) * glm::vec4(0.0f, 0.0f, -2.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 0.5) * glm::dvec4(0.0, 0.0, -2.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI) * glm::vec4(-2.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI) * glm::dvec4(-2.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 1.5) * glm::vec4(0.0f, 0.0f, 2.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 1.5) * glm::dvec4(0.0, 0.0, 2.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 360° position should be (sma,0,0), the initial position
);
// at 360° position should be (sma,0,0), the initial position
- pos = orbit.InverseMatrix(PI * 2.0) * glm::vec4(2.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 2.0) * glm::dvec4(2.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- glm::vec4 pos(orbit.InverseMatrix(0.0) * glm::vec4(0.5f, 0.0f, 0.0f, 1.0f));
+ glm::dvec4 pos(orbit.InverseMatrix(0.0) * glm::dvec4(0.5, 0.0, 0.0, 1.0));
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 0.5) * glm::vec4(-0.935130834579468f, 0.0f, -0.779740869998932f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 0.5) * glm::dvec4(-0.93513085903671, 0.0, -0.779740887497559, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI) * glm::vec4(-1.5f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI) * glm::dvec4(-1.5, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 1.5) * glm::vec4(-0.935130834579468f, 0.0f, 0.779740869998932f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 1.5) * glm::dvec4(-0.93513085903671, 0.0, 0.779740887497559, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 2.0) * glm::vec4(0.5f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 2.0) * glm::dvec4(0.5, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
Orbit orbit;
orbit.Inclination(PI * 0.25); // 45°
// inclination rotates counter clockwise around +X, so at t=0 should be
// at (sma,0,0) relative to its parent
Orbit orbit;
orbit.Inclination(PI * 0.25); // 45°
// inclination rotates counter clockwise around +X, so at t=0 should be
// at (sma,0,0) relative to its parent
- glm::vec4 pos(orbit.InverseMatrix(0.0) * glm::vec4(1.0f, 0.0f, 0.0f, 1.0f));
+ glm::dvec4 pos(orbit.InverseMatrix(0.0) * glm::dvec4(1.0, 0.0, 0.0, 1.0));
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 0.5) * glm::vec4(0.0f, 0.70710676908493f, -0.70710676908493f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 0.5) * glm::dvec4(0.0, 0.707106781186548, -0.707106781186548, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI) * glm::vec4(-1.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI) * glm::dvec4(-1.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 1.5) * glm::vec4(0.0f, -0.70710676908493f, 0.70710676908493f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 1.5) * glm::dvec4(0.0, -0.707106781186548, 0.707106781186548, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 2.0) * glm::vec4(1.0f, 0.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 2.0) * glm::dvec4(1.0, 0.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
Orbit orbit;
orbit.LongitudeAscending(PI * 0.25); // 45°
orbit.Inclination(PI * 0.5);
// inclination rotates counter clockwise around +X, while LAN rotates it
// around +Y, so at t=0 should be at (sma*sin(45°),0,-sma*cos(45°))
Orbit orbit;
orbit.LongitudeAscending(PI * 0.25); // 45°
orbit.Inclination(PI * 0.5);
// inclination rotates counter clockwise around +X, while LAN rotates it
// around +Y, so at t=0 should be at (sma*sin(45°),0,-sma*cos(45°))
- glm::vec4 pos(orbit.InverseMatrix(0.0) * glm::vec4(0.70710676908493f, 0.0f, -0.70710676908493f, 1.0f));
+ glm::dvec4 pos(orbit.InverseMatrix(0.0) * glm::dvec4(0.707106781186548, 0.0, -0.707106781186548, 1.0));
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 0.5) * glm::vec4(0.0f, 1.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 0.5) * glm::dvec4(0.0, 1.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI) * glm::vec4(-0.70710676908493f, 0.0f, 0.70710676908493f, 1.0f);
+ pos = orbit.InverseMatrix(PI) * glm::dvec4(-0.707106781186548, 0.0, 0.707106781186548, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 1.5) * glm::vec4(0.0f, -1.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 1.5) * glm::dvec4(0.0, -1.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 2.0) * glm::vec4(0.70710676908493f, 0.0f, -0.70710676908493f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 2.0) * glm::dvec4(0.707106781186548, 0.0, -0.707106781186548, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
// inclination rotates counter clockwise around +X, while APe rotates it
// around +Y in the rotated coordinate system, so at t=0 should be at
// (sma*sin(45°),0,sma*cos(45°))
// inclination rotates counter clockwise around +X, while APe rotates it
// around +Y in the rotated coordinate system, so at t=0 should be at
// (sma*sin(45°),0,sma*cos(45°))
- glm::vec4 pos(orbit.InverseMatrix(0.0) * glm::vec4(0.70710676908493f, 0.0f, 0.70710676908493f, 1.0f));
+ glm::dvec4 pos(orbit.InverseMatrix(0.0) * glm::dvec4(0.707106781186548, 0.0, 0.707106781186548, 1.0));
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 0.5) * glm::vec4(0.0f, 1.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 0.5) * glm::dvec4(0.0, 1.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI) * glm::vec4(-0.70710676908493f, 0.0f, -0.70710676908493f, 1.0f);
+ pos = orbit.InverseMatrix(PI) * glm::dvec4(-0.707106781186548, 0.0, -0.707106781186548, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 1.5) * glm::vec4(0.0f, -1.0f, 0.0f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 1.5) * glm::dvec4(0.0, -1.0, 0.0, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 2.0) * glm::vec4(0.70710676908493f, 0.0f, 0.70710676908493f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 2.0) * glm::dvec4(0.707106781186548, 0.0, 0.707106781186548, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- glm::vec4 pos(orbit.InverseMatrix(0.0) * glm::vec4(0.70710676908493f, 0.0f, -0.70710676908493f, 1.0f));
+ glm::dvec4 pos(orbit.InverseMatrix(0.0) * glm::dvec4(0.707106781186548, 0.0, -0.707106781186548, 1.0));
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
);
// at 90° position should be (0,0,sma) since the zero inclination
// reference plane is XZ and rotates counter-clockwise
- pos = orbit.InverseMatrix(PI * 0.5) * glm::vec4(-0.70710676908493f, 0.0f, -0.70710676908493f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 0.5) * glm::dvec4(-0.707106781186548, 0.0, -0.707106781186548, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI) * glm::vec4(-0.70710676908493f, 0.0f, 0.70710676908493f, 1.0f);
+ pos = orbit.InverseMatrix(PI) * glm::dvec4(-0.707106781186548, 0.0, 0.707106781186548, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
- pos = orbit.InverseMatrix(PI * 1.5) * glm::vec4(0.70710676908493f, 0.0f, 0.70710676908493f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 1.5) * glm::dvec4(0.707106781186548, 0.0, 0.707106781186548, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon
);
// at 360° position should be (sma,0,0), the initial position
);
// at 360° position should be (sma,0,0), the initial position
- pos = orbit.InverseMatrix(PI * 2.0) * glm::vec4(0.70710676908493f, 0.0f, -0.70710676908493f, 1.0f);
+ pos = orbit.InverseMatrix(PI * 2.0) * glm::dvec4(0.707106781186548, 0.0, -0.707106781186548, 1.0);
- glm::vec3(0.0f, 0.0f, 0.0f),
- glm::vec3(pos) / pos.w
+ glm::dvec3(0.0, 0.0, 0.0),
+ glm::dvec3(pos) / pos.w,
+ epsilon