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
283#if !defined A_HAVE_INLINE || defined(LIBA_LINE3_C)
286#define A_INTERN static A_INLINE
289#if defined(__cplusplus)
301#if defined(__cplusplus)
382 return a_line3_segdist(
this, min1, max1, &rhs, min2, max2, &w1, &p1, &w2, &p2);
388 return a_line3_segdist2(
this, min1, max1, &rhs, min2, max2, &w1, &p1, &w2, &p2);
399 return a_line3_int1(
this, min1, max1, &rhs, min2, max2, &w1, &w2);
414#if defined(LIBA_LINE3_C)
417#define A_INTERN A_INLINE
420#if defined(A_HAVE_INLINE) || defined(LIBA_LINE3_C)
453 res->x = o->x + d->x * w;
454 res->y = o->y + d->y * w;
455 res->z = o->z + d->z * w;
459#if defined(LIBA_LINE3_C)
462#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:297
a_vector3 dir_
Definition line3.h:299
a_point3 org
Definition line3.h:298
a_real parm(a_point3 const &rhs) const
compute the scalar projection parameter of a point onto the infinite line.
Definition line3.h:339
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:396
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:385
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:374
a_vector3 const & dir() const
get the address of the direction vector of the line.
Definition line3.h:310
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:354
a_real dist(a_point3 const &rhs) const
compute the distance from a point to the infinite line.
Definition line3.h:359
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:369
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:379
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:391
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:349
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:312
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:324
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:407
void eval(a_real w, a_point3 &res) const
evaluate a point on the line at a given parameter.
Definition line3.h:334
void set_org(a_real x, a_real y, a_real z)
set the origin coordinates of the line.
Definition line3.h:305
a_real dist2(a_point3 const &rhs) const
compute the squared distance from a point to the infinite line.
Definition line3.h:364
void tgt(a_point3 &res) const
compute the target endpoint of the line segment.
Definition line3.h:317
a_real max
Definition line3.h:300
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:319
a_real proj(a_point3 const &rhs, a_point3 &res) const
project a point onto the infinite line.
Definition line3.h:344
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:329
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:402
void set_max(a_real max_)
set the maximum length of the line segment.
Definition line3.h:303
instance structure for three-dimensional point
Definition point3.h:350
instance structure for three-dimensional vector
Definition vector3.h:415