Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Public Member Functions | Public Attributes | List of all members
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. More...
 
float angle (const LineSeg2f &o) const noexcept
 Return the angle between two line segments in radians. More...
 
AABBox2f box () const noexcept override
 Create an AABBox with given lineseg. More...
 
bool contains (const Point2f &p2) const noexcept override
 Test intersection between this line segment and the give point. More...
 
float distance (Point2f p) const noexcept
 Returns minimum distance between this line segment and given point p. More...
 
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. More...
 
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. More...
 
bool intersects (Point2f &result, const LineSeg2f &o) const noexcept
 Compute intersection between two lines segments. More...
 
constexpr float length () const noexcept
 Return the length of this line segment, i.e. More...
 
constexpr LineSeg2foperator*= (const float s) noexcept
 Scale this line segment with given scale factor. More...
 
std::string toString () const noexcept override
 
- Public Member Functions inherited from jau::math::geom::Geom2f
virtual ~Geom2f ()=default
 
virtual AABBox2f box () const noexcept=0
 
virtual bool contains (const Point2f &o) const noexcept=0
 
virtual bool intersection (Vec2f &reflect_out, Vec2f &cross_normal, Point2f &cross_point, const LineSeg2f &in) const noexcept=0
 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. More...
 
virtual bool intersects (const AABBox2f &box) const noexcept=0
 
virtual bool intersects (const Geom2f &o) const noexcept=0
 
virtual bool intersects (const LineSeg2f &o) const noexcept=0
 
virtual std::string toString () const noexcept=0
 

Public Attributes

Point2f p0
 
Point2f p1
 

Detailed Description

Definition at line 96 of file geom2f.hpp.

Constructor & Destructor Documentation

◆ LineSeg2f() [1/2]

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

Definition at line 101 of file geom2f.hpp.

◆ LineSeg2f() [2/2]

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

Definition at line 104 of file geom2f.hpp.

Member Function Documentation

◆ operator*=()

constexpr 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 112 of file geom2f.hpp.

◆ length()

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

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

distance between both points.

Definition at line 121 of file geom2f.hpp.

◆ angle() [1/2]

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

Return the angle of this line segment in radians.

Definition at line 128 of file geom2f.hpp.

◆ 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 135 of file geom2f.hpp.

◆ add()

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

Definition at line 141 of file geom2f.hpp.

◆ toString()

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

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

Definition at line 149 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 154 of file geom2f.hpp.

◆ 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 181 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 274 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 283 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 339 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 356 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 384 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 388 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 398 of file geom2f.hpp.

Member Data Documentation

◆ p0

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

Definition at line 98 of file geom2f.hpp.

◆ p1

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

Definition at line 99 of file geom2f.hpp.


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