mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Adress review comments
This commit is contained in:
@@ -36,7 +36,7 @@ namespace openspace::interaction {
|
||||
|
||||
struct NavigationState {
|
||||
NavigationState() = default;
|
||||
NavigationState(const ghoul::Dictionary& dictionary);
|
||||
explicit NavigationState(const ghoul::Dictionary& dictionary);
|
||||
NavigationState(std::string anchor, std::string aim, std::string referenceFrame,
|
||||
glm::dvec3 position, std::optional<glm::dvec3> up = std::nullopt,
|
||||
double yaw = 0.0, double pitch = 0.0);
|
||||
|
||||
@@ -57,49 +57,49 @@ public:
|
||||
Waypoint startPoint() const;
|
||||
Waypoint endPoint() const;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the specified duration for the path, in seconds. Note that the time it
|
||||
* takes to actually traverse the path will not exactly match the provided duration
|
||||
*/
|
||||
double duration() const;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the total length of the the curve for the path, in meters
|
||||
*/
|
||||
double pathLength() const;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return a vector of positions corresponding to the control points of the path's
|
||||
* spline curve
|
||||
*/
|
||||
std::vector<glm::dvec3> controlPoints() const;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Take a step along the current path, corresponding to the delta time step \p dt, and
|
||||
* return the resulting camera pose. The \p speedScale is a factor that will be
|
||||
* multiplied with the traversal speed
|
||||
*/
|
||||
CameraPose traversePath(double dt, float speedScale = 1.f);
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the identifer of the node that is the current appropriate anchor node, of
|
||||
* the start and end waypoint's reference node. Dtermined based on how far along the
|
||||
* path we have traveled
|
||||
*/
|
||||
std::string currentAnchor() const;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return wether the path has reached its end point or not
|
||||
*/
|
||||
bool hasReachedEnd() const;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Compute the interpolated camera pose at a certain distance along the path
|
||||
*/
|
||||
CameraPose interpolatedPose(double distance) const;
|
||||
|
||||
private:
|
||||
/*
|
||||
/**
|
||||
* Interpolate between the paths start and end rotation using the approach that
|
||||
* corresponds to the path's curve type. The interpolation parameter \p t is the
|
||||
* same as for the position interpolation, i.e. the relative traveled in distance
|
||||
@@ -107,24 +107,24 @@ private:
|
||||
*/
|
||||
glm::dquat interpolateRotation(double t) const;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Compute the interpolated rotation quaternion using an eased SLERP approach
|
||||
*/
|
||||
glm::dquat easedSlerpRotation(double t) const;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Compute the interpolated rotation quaternion using an approach that first
|
||||
* interpolates to look at the start node, and then the end node, before
|
||||
* interpolating to the end rotation
|
||||
*/
|
||||
glm::dquat lookAtTargetsRotation(double t) const;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Evaluate the current traversal speed along the path, based on the currently
|
||||
* traveled distance. The final speed will be scaled to match the desired duration
|
||||
* for the path (which might have been specified by the user)
|
||||
*/
|
||||
double speedAlongPath(double traveledDistance);
|
||||
double speedAlongPath(double traveledDistance) const;
|
||||
|
||||
Waypoint _start;
|
||||
Waypoint _end;
|
||||
|
||||
@@ -36,43 +36,45 @@ class PathCurve {
|
||||
public:
|
||||
virtual ~PathCurve() = 0;
|
||||
|
||||
const double length() const;
|
||||
double length() const;
|
||||
|
||||
/*
|
||||
* Compute and rteturn the position along the path at the specified relative
|
||||
/**
|
||||
* Compute and return the position along the path at the specified relative
|
||||
* distance. The input parameter should be in range [0, 1], where 1 correspond to
|
||||
* the full length of the path
|
||||
*/
|
||||
glm::dvec3 positionAt(double relativeDistance);
|
||||
glm::dvec3 positionAt(double relativeDistance) const;
|
||||
|
||||
/*
|
||||
* Compute curve parameter u that matches the input arc length s
|
||||
/**
|
||||
* Get the intorlatied position along the spline, based on the given curve parameter
|
||||
* u in range [0, 1]. A curve parameter of 0 returns the start position and 1 the end
|
||||
* position. Note that u does not correspond to the relatively traveled distance.
|
||||
*/
|
||||
virtual glm::dvec3 interpolate(double u);
|
||||
virtual glm::dvec3 interpolate(double u) const;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Return the positions defining the control points for the spline interpolation
|
||||
*/
|
||||
std::vector<glm::dvec3> points();
|
||||
std::vector<glm::dvec3> points() const;
|
||||
|
||||
protected:
|
||||
/*
|
||||
/**
|
||||
* Precompute information related to the spline parameters, that are
|
||||
* needed for arc length reparameterization. Must be called after
|
||||
* control point creation
|
||||
*/
|
||||
void initializeParameterData();
|
||||
|
||||
/*
|
||||
/**
|
||||
* Compute curve parameter u that matches the input arc length s.
|
||||
* Input s is a length value, in the range [0, _totalLength]. The returned curve
|
||||
* parameter u is in range [0, 1]
|
||||
*/
|
||||
double curveParameter(double s);
|
||||
double curveParameter(double s) const;
|
||||
|
||||
double approximatedDerivative(double u, double h = 0.0001);
|
||||
double arcLength(double limit = 1.0);
|
||||
double arcLength(double lowerLimit, double upperLimit);
|
||||
double approximatedDerivative(double u, double h = 0.0001) const;
|
||||
double arcLength(double limit = 1.0) const;
|
||||
double arcLength(double lowerLimit, double upperLimit) const;
|
||||
|
||||
std::vector<glm::dvec3> _points;
|
||||
unsigned int _nSegments = 0;
|
||||
|
||||
@@ -39,7 +39,7 @@ class Waypoint {
|
||||
public:
|
||||
Waypoint() = default;
|
||||
Waypoint(const glm::dvec3& pos, const glm::dquat& rot, const std::string& ref);
|
||||
Waypoint(const NavigationState& ns);
|
||||
explicit Waypoint(const NavigationState& ns);
|
||||
|
||||
static double findValidBoundingSphere(const SceneGraphNode* node);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user