3#include <Core/Containers/VectorArray.hpp>
4#include <Core/Geometry/DistanceQueries.hpp>
5#include <Core/Math/LinearAlgebra.hpp>
6#include <Core/RaCore.hpp>
19 explicit PolyLine(
const Vector3Array& pt );
22 inline const Vector3Array& getPoints()
const;
25 inline void getSegment( uint segment, Vector3& aOut, Vector3& abOut )
const;
28 inline const Vector3Array& getSegmentVectors()
const;
31 inline Aabb aabb()
const;
34 inline Scalar length()
const;
37 void setPoints(
const Vector3Array& pt );
40 Scalar squaredDistance(
const Vector3& p )
const;
43 Scalar distance(
const Vector3& p )
const;
47 Scalar projectOnSegment(
const Vector3& p, uint segment )
const;
50 uint getNearestSegment(
const Vector3& p )
const;
53 inline uint getSegmentIndex( Scalar t )
const;
57 Scalar project(
const Vector3& p )
const;
61 Vector3 f( Scalar t )
const;
70 inline Scalar getLineParameter( uint segment, Scalar tSegment )
const;
76 Vector3Array m_ptsDiff;
86 return m_lengths.
back();
91 for (
const auto& v : m_pts ) {
98 CORE_ASSERT( segment < m_ptsDiff.size(),
"invalid segment index" );
99 const Scalar lprev = segment > 0 ? m_lengths[segment - 1] : 0;
100 const Scalar lSegment = m_lengths[segment] - lprev;
101 return ( ( lSegment * tSegment ) + lprev ) /
length();
105 CORE_ASSERT( segment < m_ptsDiff.size(),
"Invalid segment index." );
106 aOut = m_pts[segment];
107 abOut = m_ptsDiff[segment];
118 while ( m_lengths[i] < param ) {
void getSegment(uint segment, Vector3 &aOut, Vector3 &abOut) const
Get the ith segment AB as starting point A and vector AB.
Aabb aabb() const
Get the aabb of the polyline.
const Vector3Array & getPoints() const
Get the point vector.
uint getSegmentIndex(Scalar t) const
Returns the index of the segment to which t belons.
Scalar getLineParameter(uint segment, Scalar tSegment) const
Scalar length() const
Get the total length of the line .
const Vector3Array & getSegmentVectors() const
Get the segment vector ( Pi+1 - Pi)
constexpr T saturate(T v)
Clamps the value between 0 and 1.
@ Geometry
"Geometry" render objects are those loaded using Radium::IO and generated by GeometrySystem
hepler function to manage enum as underlying types in VariableSet