liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches

instance structure for two-dimensional line defined by an origin, a direction vector, and a length More...

#include <line2.h>

Collaboration diagram for a_line2:
[legend]

Public Member Functions

void set_max (a_real max_)
 set the maximum length of the line segment.
void set_org (a_real x, a_real y)
 set the origin coordinates of the line.
a_vector2 const & dir () const
 get the address of the direction vector of the line.
int set_dir (a_real x, a_real y)
 set the direction vector and length of the line using raw components.
void tgt (a_point2 &res) const
 compute the target endpoint of the line segment.
int set_tgt (a_real x, a_real y)
 Set the line direction and length based on a target point relative to the current origin.
int set (a_point2 const &p, a_vector2 const &v)
 initialize the line segment from a start point and a direction vector.
int set (a_point2 const &p, a_point2 const &q)
 initialize the line segment from two points (start point p, end point q).
void eval (a_real w, a_point2 &res) const
 evaluate a point on the line at a given parameter.
a_real parm (a_point2 const &rhs) const
 compute the scalar projection parameter of a point onto the infinite line.
a_real proj (a_point2 const &rhs, a_point2 &res) const
 project a point onto the infinite line.
a_real limparm (a_real min_, a_real max_, a_point2 const &rhs) const
 compute the scalar projection parameter of a point onto the line segment.
a_real limproj (a_real min_, a_real max_, a_point2 const &rhs, a_point2 &res) const
 project a point onto a line segment.
a_real sdist (a_point2 const &rhs) const
 compute the signed distance from a point to the infinite line.
a_real dist (a_point2 const &rhs) const
 compute the absolute distance from a point to the infinite line.
a_real limdist (a_real min_, a_real max_, a_point2 const &rhs, a_real &w, a_point2 &p)
 compute the distance from a point to the closest point on a line segment.
a_real limdist2 (a_real min_, a_real max_, a_point2 const &rhs, a_real &w, a_point2 &p)
 compute the squared distance from a point to the closest point on a line segment.
a_real segdist (a_real min1, a_real max1, a_line2 const &rhs, a_real min2, a_real max2, a_real &w1, a_point2 &p1, a_real &w2, a_point2 &p2) const
 compute the distance between two line segments.
a_real segdist2 (a_real min1, a_real max1, a_line2 const &rhs, a_real min2, a_real max2, a_real &w1, a_point2 &p1, a_real &w2, a_point2 &p2) const
 compute the squared distance between two line segments.
int int0 (a_real min_, a_real max_, a_point2 const &rhs, a_real &w) const
 compute the intersection between a point and a line segment.
int int1 (a_real min1, a_real max1, a_line2 const &rhs, a_real min2, a_real max2, a_real &w1, a_real &w2) const
 compute the intersection between two line segments.
void rot (a_point2 const &rhs, a_real sin, a_real cos, a_line2 &res) const
 rotate a line segment around a pivot point using pre-calculated sine and cosine values.
void rot (a_point2 const &rhs, a_real angle, a_line2 &res) const
 rotate a line segment around a specified pivot point.

Data Fields

a_point2 org
a_vector2 dir_
a_real max

Detailed Description

instance structure for two-dimensional line defined by an origin, a direction vector, and a length

Member Function Documentation

◆ dir()

a_vector2 const & a_line2::dir ( ) const
inline

get the address of the direction vector of the line.

See also
a_line2_dir

◆ dist()

a_real a_line2::dist ( a_point2 const & rhs) const
inline

compute the absolute distance from a point to the infinite line.

See also
a_line2_dist

◆ eval()

void a_line2::eval ( a_real w,
a_point2 & res ) const
inline

evaluate a point on the line at a given parameter.

See also
a_line2_eval

◆ int0()

int a_line2::int0 ( a_real min_,
a_real max_,
a_point2 const & rhs,
a_real & w ) const
inline

compute the intersection between a point and a line segment.

See also
a_line2_int0

◆ int1()

int a_line2::int1 ( a_real min1,
a_real max1,
a_line2 const & rhs,
a_real min2,
a_real max2,
a_real & w1,
a_real & w2 ) const
inline

compute the intersection between two line segments.

See also
a_line2_int1

◆ limdist()

a_real a_line2::limdist ( a_real min_,
a_real max_,
a_point2 const & rhs,
a_real & w,
a_point2 & p )
inline

compute the distance from a point to the closest point on a line segment.

See also
a_line2_limdist

◆ limdist2()

a_real a_line2::limdist2 ( a_real min_,
a_real max_,
a_point2 const & rhs,
a_real & w,
a_point2 & p )
inline

compute the squared distance from a point to the closest point on a line segment.

See also
a_line2_limdist2

◆ limparm()

a_real a_line2::limparm ( a_real min_,
a_real max_,
a_point2 const & rhs ) const
inline

compute the scalar projection parameter of a point onto the line segment.

See also
a_line2_limparm

◆ limproj()

a_real a_line2::limproj ( a_real min_,
a_real max_,
a_point2 const & rhs,
a_point2 & res ) const
inline

project a point onto a line segment.

See also
a_line2_limproj

◆ parm()

a_real a_line2::parm ( a_point2 const & rhs) const
inline

compute the scalar projection parameter of a point onto the infinite line.

See also
a_line2_parm

◆ proj()

a_real a_line2::proj ( a_point2 const & rhs,
a_point2 & res ) const
inline

project a point onto the infinite line.

See also
a_line2_proj

◆ rot() [1/2]

void a_line2::rot ( a_point2 const & rhs,
a_real angle,
a_line2 & res ) const
inline

rotate a line segment around a specified pivot point.

See also
a_line2_rot

◆ rot() [2/2]

void a_line2::rot ( a_point2 const & rhs,
a_real sin,
a_real cos,
a_line2 & res ) const
inline

rotate a line segment around a pivot point using pre-calculated sine and cosine values.

See also
a_line2_rot_

◆ sdist()

a_real a_line2::sdist ( a_point2 const & rhs) const
inline

compute the signed distance from a point to the infinite line.

See also
a_line2_sdist

◆ segdist()

a_real a_line2::segdist ( a_real min1,
a_real max1,
a_line2 const & rhs,
a_real min2,
a_real max2,
a_real & w1,
a_point2 & p1,
a_real & w2,
a_point2 & p2 ) const
inline

compute the distance between two line segments.

See also
a_line2_segdist

◆ segdist2()

a_real a_line2::segdist2 ( a_real min1,
a_real max1,
a_line2 const & rhs,
a_real min2,
a_real max2,
a_real & w1,
a_point2 & p1,
a_real & w2,
a_point2 & p2 ) const
inline

compute the squared distance between two line segments.

See also
a_line2_segdist2

◆ set() [1/2]

int a_line2::set ( a_point2 const & p,
a_point2 const & q )
inline

initialize the line segment from two points (start point p, end point q).

See also
a_line2_set

◆ set() [2/2]

int a_line2::set ( a_point2 const & p,
a_vector2 const & v )
inline

initialize the line segment from a start point and a direction vector.

See also
a_line2_setv

◆ set_dir()

int a_line2::set_dir ( a_real x,
a_real y )
inline

set the direction vector and length of the line using raw components.

See also
a_line2_set_dir

◆ set_max()

void a_line2::set_max ( a_real max_)
inline

set the maximum length of the line segment.

See also
a_line2_set_max

◆ set_org()

void a_line2::set_org ( a_real x,
a_real y )
inline

set the origin coordinates of the line.

See also
a_line2_set_org

◆ set_tgt()

int a_line2::set_tgt ( a_real x,
a_real y )
inline

Set the line direction and length based on a target point relative to the current origin.

See also
a_line2_set_tgt

◆ tgt()

void a_line2::tgt ( a_point2 & res) const
inline

compute the target endpoint of the line segment.

See also
a_line2_tgt

Field Documentation

◆ dir_

a_vector2 a_line2::dir_

normalized direction vector of the line

◆ max

a_real a_line2::max

maximum length of the line segment

◆ org

a_point2 a_line2::org

origin point of the line


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