Gamp v0.0.7-36-g24b1eb6
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
jau::math::geom::LineSeg2f Class Reference

#include <geom2f.hpp>

Inheritance diagram for jau::math::geom::LineSeg2f:
Collaboration diagram for jau::math::geom::LineSeg2f:

Public Member Functions

constexpr LineSeg2f () noexcept
 
constexpr LineSeg2f (const Point2f &p0_, const Point2f &p1_) noexcept
 
void add (float length)
 
float angle () const noexcept
 Return the angle of this line segment in radians.
 
float angle (const LineSeg2f &o) const noexcept
 Return the angle between two line segments in radians.
 
AABBox2f box () const noexcept override
 Create an AABBox with given lineseg.
 
bool contains (const Point2f &p2) const noexcept override
 Test intersection between this line segment and the give point.
 
float distance (Point2f p) const noexcept
 Returns minimum distance between this line segment and given point p.
 
bool intersection (const AABBox2f &box, Vec2f &reflect_out, Vec2f &cross_normal, Point2f &cross_point) const noexcept
 
bool intersection (Vec2f &reflect_out, Vec2f &cross_normal, Point2f &cross_point, const LineSeg2f &in) const noexcept override
 Return whether this object intersects with the given line segment and if intersecting, the crossing point (intersection), the normalized normal of the crossing surface and the reflection out vector.
 
bool intersects (const AABBox2f &box) const noexcept override
 
bool intersects (const Geom2f &o) const noexcept override
 
bool intersects (const LineSeg2f &o) const noexcept override
 Return true if this line segment intersect with the given line segment.
 
bool intersects (Point2f &result, const LineSeg2f &o) const noexcept
 Compute intersection between two lines segments.
 
constexpr float length () const noexcept
 Return the length of this line segment, i.e.
 
constexpr LineSeg2foperator*= (const float s) noexcept
 Scale this line segment with given scale factor.
 
std::string toString () const noexcept override
 
- Public Member Functions inherited from jau::math::geom::Geom2f
virtual ~Geom2f ()=default
 

Public Attributes

Point2f p0
 
Point2f p1
 

Detailed Description

Definition at line 157 of file geom2f.hpp.

Constructor & Destructor Documentation

◆ LineSeg2f() [1/2]

jau::math::geom::LineSeg2f::LineSeg2f ( )
inlineconstexprnoexcept

Definition at line 162 of file geom2f.hpp.

Here is the caller graph for this function:

◆ LineSeg2f() [2/2]

jau::math::geom::LineSeg2f::LineSeg2f ( const Point2f & p0_,
const Point2f & p1_ )
inlineconstexprnoexcept

Definition at line 165 of file geom2f.hpp.

Member Function Documentation

◆ operator*=()

LineSeg2f & jau::math::geom::LineSeg2f::operator*= ( const float s)
inlineconstexprnoexcept

Scale this line segment with given scale factor.

Parameters
sscale factor
Returns
this instance

Definition at line 173 of file geom2f.hpp.

◆ length()

float jau::math::geom::LineSeg2f::length ( ) const
inlineconstexprnoexcept

Return the length of this line segment, i.e.

distance between both points.

Definition at line 182 of file geom2f.hpp.

Here is the caller graph for this function:

◆ angle() [1/2]

float jau::math::geom::LineSeg2f::angle ( ) const
inlinenoexcept

Return the angle of this line segment in radians.

Definition at line 189 of file geom2f.hpp.

Here is the caller graph for this function:

◆ angle() [2/2]

float jau::math::geom::LineSeg2f::angle ( const LineSeg2f & o) const
inlinenoexcept

Return the angle between two line segments in radians.

Definition at line 196 of file geom2f.hpp.

◆ add()

void jau::math::geom::LineSeg2f::add ( float length)
inline

Definition at line 202 of file geom2f.hpp.

◆ toString()

std::string jau::math::geom::LineSeg2f::toString ( ) const
inlineoverridevirtualnoexcept

Implements jau::math::geom::Geom2f.

Definition at line 210 of file geom2f.hpp.

◆ box()

AABBox2f jau::math::geom::LineSeg2f::box ( ) const
inlineoverridevirtualnoexcept

Create an AABBox with given lineseg.

Implements jau::math::geom::Geom2f.

Definition at line 215 of file geom2f.hpp.

Here is the caller graph for this function:

◆ contains()

bool jau::math::geom::LineSeg2f::contains ( const Point2f & p2) const
inlineoverridevirtualnoexcept

Test intersection between this line segment and the give point.

Returns
true if the line segment contains the point, otherwise false

Implements jau::math::geom::Geom2f.

Definition at line 242 of file geom2f.hpp.

◆ intersects() [1/4]

bool jau::math::geom::LineSeg2f::intersects ( Point2f & result,
const LineSeg2f & o ) const
inlinenoexcept

Compute intersection between two lines segments.

Parameters
resultstorage for the intersection coordinates if the lines intersect, otherwise unchanged
othe other line segment.
Returns
true if the line segments intersect, otherwise false

Definition at line 262 of file geom2f.hpp.

◆ intersects() [2/4]

bool jau::math::geom::LineSeg2f::intersects ( const LineSeg2f & o) const
inlineoverridevirtualnoexcept

Return true if this line segment intersect with the given line segment.

Parameters
othe other line segment.
Returns
true if both intersect, otherwise false

Implements jau::math::geom::Geom2f.

Definition at line 271 of file geom2f.hpp.

◆ distance()

float jau::math::geom::LineSeg2f::distance ( Point2f p) const
inlinenoexcept

Returns minimum distance between this line segment and given point p.

See Shortest distance between a point and a line segment

Slightly more expensive than intersects().

Definition at line 284 of file geom2f.hpp.

Here is the caller graph for this function:

◆ intersects() [3/4]

bool jau::math::geom::LineSeg2f::intersects ( const AABBox2f & box) const
inlineoverridevirtualnoexcept

Implements jau::math::geom::Geom2f.

Definition at line 301 of file geom2f.hpp.

◆ intersects() [4/4]

bool jau::math::geom::LineSeg2f::intersects ( const Geom2f & o) const
inlineoverridevirtualnoexcept

Implements jau::math::geom::Geom2f.

Definition at line 329 of file geom2f.hpp.

◆ intersection() [1/2]

bool jau::math::geom::LineSeg2f::intersection ( Vec2f & reflect_out,
Vec2f & cross_normal,
Point2f & cross_point,
const LineSeg2f & in ) const
inlineoverridevirtualnoexcept

Return whether this object intersects with the given line segment and if intersecting, the crossing point (intersection), the normalized normal of the crossing surface and the reflection out vector.

Implements jau::math::geom::Geom2f.

Definition at line 333 of file geom2f.hpp.

Here is the caller graph for this function:

◆ intersection() [2/2]

bool jau::math::geom::LineSeg2f::intersection ( const AABBox2f & box,
Vec2f & reflect_out,
Vec2f & cross_normal,
Point2f & cross_point ) const
inlinenoexcept

Definition at line 343 of file geom2f.hpp.

Member Data Documentation

◆ p0

Point2f jau::math::geom::LineSeg2f::p0

Definition at line 159 of file geom2f.hpp.

◆ p1

Point2f jau::math::geom::LineSeg2f::p1

Definition at line 160 of file geom2f.hpp.


The documentation for this class was generated from the following file: