19#define a_line3_c(x) a_cast_s(a_line3, x)
20#define a_line3_(_, x) a_cast_s(a_line3 _, x)
24#if defined(__cplusplus)
31#if !defined A_HAVE_INLINE || defined(LIBA_LINE3_C)
34#define A_INTERN A_PUBLIC extern
298#if !defined A_HAVE_INLINE || defined(LIBA_LINE3_C)
301#define A_INTERN static A_INLINE
304#if defined(__cplusplus)
316#if defined(__cplusplus)
397 return a_line3_segdist(
this, min1, max1, &rhs, min2, max2, &w1, &p1, &w2, &p2);
403 return a_line3_segdist2(
this, min1, max1, &rhs, min2, max2, &w1, &p1, &w2, &p2);
414 return a_line3_int1(
this, min1, max1, &rhs, min2, max2, &w1, &w2);
429#if defined(LIBA_LINE3_C)
432#define A_INTERN A_INLINE
435#if defined(A_HAVE_INLINE) || defined(LIBA_LINE3_C)
468 res->x = o->x + d->x * w;
469 res->y = o->y + d->y * w;
470 res->z = o->z + d->z * w;
474#if defined(LIBA_LINE3_C)
477#define A_INTERN static A_INLINE
a_real a_line3_limdist(a_line3 const *ctx, a_real min, a_real max, a_point3 const *rhs, a_real *w, a_point3 *p)
compute the distance from a point to the closest point on a line segment.
int a_line3_set(a_line3 *ctx, a_point3 const *p, a_point3 const *q)
initialize the line segment from two points (start point p, end point q).
a_real a_line3_max(a_line3 const *ctx)
get the maximum length of the line segment.
a_real a_line3_segdist2(a_line3 const *ctx, a_real min1, a_real max1, a_line3 const *rhs, a_real min2, a_real max2, a_real *w1, a_point3 *p1, a_real *w2, a_point3 *p2)
compute the squared distance between two line segments.
a_real a_line3_parm(a_line3 const *ctx, a_point3 const *rhs)
compute the scalar projection parameter of a point onto the infinite line.
a_real a_line3_dist(a_line3 const *ctx, a_point3 const *rhs)
compute the distance from a point to the infinite line.
a_real a_line3_proj(a_line3 const *ctx, a_point3 const *rhs, a_point3 *res)
project a point onto the infinite line.
int a_line3_int0(a_line3 const *ctx, a_real min, a_real max, a_point3 const *rhs, a_real *w)
compute the intersection between a point and a line segment.
int a_line3_setv(a_line3 *ctx, a_point3 const *p, a_vector3 const *v)
initialize the line segment from a start point and a direction vector.
void a_line3_set_org(a_line3 *ctx, a_real x, a_real y, a_real z)
set the origin coordinates of the line.
void a_line3_eval(a_line3 const *ctx, a_real w, a_point3 *res)
evaluate a point on the line at a given parameter.
a_real a_line3_limproj(a_line3 const *ctx, a_real min, a_real max, a_point3 const *rhs, a_point3 *res)
project a point onto a line segment.
a_real a_line3_limdist2(a_line3 const *ctx, a_real min, a_real max, a_point3 const *rhs, a_real *w, a_point3 *p)
compute the squared distance from a point to the closest point on a line segment.
a_vector3 const * a_line3_dir(a_line3 const *ctx)
get the address of the direction vector of the line.
void a_line3_tgt(a_line3 const *ctx, a_point3 *res)
compute the target endpoint of the line segment.
int a_line3_set_tgt(a_line3 *ctx, a_real x, a_real y, a_real z)
Set the line direction and length based on a target point relative to the current origin.
a_real a_line3_dist2(a_line3 const *ctx, a_point3 const *rhs)
compute the squared distance from a point to the infinite line.
a_real a_line3_limparm(a_line3 const *ctx, a_real min, a_real max, a_point3 const *rhs)
compute the scalar projection parameter of a point onto the line segment.
a_point3 const * a_line3_org(a_line3 const *ctx)
get the address of the origin point of the line.
a_real a_line3_segdist(a_line3 const *ctx, a_real min1, a_real max1, a_line3 const *rhs, a_real min2, a_real max2, a_real *w1, a_point3 *p1, a_real *w2, a_point3 *p2)
compute the distance between two line segments.
int a_line3_int1(a_line3 const *ctx, a_real min1, a_real max1, a_line3 const *rhs, a_real min2, a_real max2, a_real *w1, a_real *w2)
compute the intersection between two line segments.
void a_line3_rot(a_line3 const *ctx, a_line3 const *rhs, a_real angle, a_line3 *res)
rotate a 3D line segment around an arbitrary axis defined by another line.
void a_line3_set_max(a_line3 *ctx, a_real max)
set the maximum length of the line segment.
int a_line3_set_dir(a_line3 *ctx, a_real x, a_real y, a_real z)
set the direction vector and length of the line using raw components.
void a_line3_rot_(a_line3 const *ctx, a_line3 const *rhs, a_real sin, a_real cos, a_line3 *res)
rotate a 3D line segment around an arbitrary axis defined by another line.
double a_real
compiler built-in floating-point number type
Definition a.h:1012
instance structure for three-dimensional line defined by an origin, a direction vector,...
Definition line3.h:312
a_vector3 dir_
Definition line3.h:314
a_point3 org
Definition line3.h:313
a_real parm(a_point3 const &rhs) const
compute the scalar projection parameter of a point onto the infinite line.
Definition line3.h:354
int int1(a_real min1, a_real max1, a_line3 const &rhs, a_real min2, a_real max2, a_real &w1, a_real &w2) const
compute the intersection between two line segments.
Definition line3.h:411
a_real segdist2(a_real min1, a_real max1, a_line3 const &rhs, a_real min2, a_real max2, a_real &w1, a_point3 &p1, a_real &w2, a_point3 &p2) const
compute the squared distance between two line segments.
Definition line3.h:400
a_real limdist2(a_real min_, a_real max_, a_point3 const &rhs, a_real &w, a_point3 &p)
compute the squared distance from a point to the closest point on a line segment.
Definition line3.h:389
a_vector3 const & dir() const
get the address of the direction vector of the line.
Definition line3.h:325
a_real limproj(a_real min_, a_real max_, a_point3 const &rhs, a_point3 &res) const
project a point onto a line segment.
Definition line3.h:369
a_real dist(a_point3 const &rhs) const
compute the distance from a point to the infinite line.
Definition line3.h:374
a_real limdist(a_real min_, a_real max_, a_point3 const &rhs, a_real &w, a_point3 &p)
compute the distance from a point to the closest point on a line segment.
Definition line3.h:384
a_real segdist(a_real min1, a_real max1, a_line3 const &rhs, a_real min2, a_real max2, a_real &w1, a_point3 &p1, a_real &w2, a_point3 &p2) const
compute the distance between two line segments.
Definition line3.h:394
int int0(a_real min_, a_real max_, a_point3 const &rhs, a_real &w) const
compute the intersection between a point and a line segment.
Definition line3.h:406
a_real limparm(a_real min_, a_real max_, a_point3 const &rhs) const
compute the scalar projection parameter of a point onto the line segment.
Definition line3.h:364
int set_dir(a_real x, a_real y, a_real z)
set the direction vector and length of the line using raw components.
Definition line3.h:327
int set(a_point3 const &p, a_vector3 const &v)
initialize the line segment from a start point and a direction vector.
Definition line3.h:339
void rot(a_line3 const &rhs, a_real angle, a_line3 &res) const
rotate a 3D line segment around an arbitrary axis defined by another line.
Definition line3.h:422
void eval(a_real w, a_point3 &res) const
evaluate a point on the line at a given parameter.
Definition line3.h:349
void set_org(a_real x, a_real y, a_real z)
set the origin coordinates of the line.
Definition line3.h:320
a_real dist2(a_point3 const &rhs) const
compute the squared distance from a point to the infinite line.
Definition line3.h:379
void tgt(a_point3 &res) const
compute the target endpoint of the line segment.
Definition line3.h:332
a_real max
Definition line3.h:315
int set_tgt(a_real x, a_real y, a_real z)
Set the line direction and length based on a target point relative to the current origin.
Definition line3.h:334
a_real proj(a_point3 const &rhs, a_point3 &res) const
project a point onto the infinite line.
Definition line3.h:359
int set(a_point3 const &p, a_point3 const &q)
initialize the line segment from two points (start point p, end point q).
Definition line3.h:344
void rot(a_line3 const &rhs, a_real sin, a_real cos, a_line3 &res) const
rotate a 3D line segment around an arbitrary axis defined by another line.
Definition line3.h:417
void set_max(a_real max_)
set the maximum length of the line segment.
Definition line3.h:318
instance structure for three-dimensional point
Definition point3.h:350
instance structure for three-dimensional vector
Definition vector3.h:415