liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
line2.h File Reference

two-dimensional line More...

#include "a.h"
#include "point2.h"
Include dependency graph for line2.h:

Go to the source code of this file.

Data Structures

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

Macros

#define a_line2_c(x)
#define a_line2_(_, x)

Typedefs

typedef struct a_line2 a_line2
typedef struct a_line2 a::line2

Functions

a_real a_line2_max (a_line2 const *ctx)
 get the maximum length of the line segment.
a_point2 const * a_line2_org (a_line2 const *ctx)
 get the address of the origin point of the line.
a_vector2 const * a_line2_dir (a_line2 const *ctx)
 get the address of the direction vector of the line.
void a_line2_tgt (a_line2 const *ctx, a_point2 *res)
 compute the target endpoint of the line segment.
void a_line2_set_org (a_line2 *ctx, a_real x, a_real y)
 set the origin coordinates of the line.
void a_line2_set_max (a_line2 *ctx, a_real max)
 set the maximum length of the line segment.
int a_line2_set_dir (a_line2 *ctx, a_real x, a_real y)
 set the direction vector and length of the line using raw components.
int a_line2_set_tgt (a_line2 *ctx, a_real x, a_real y)
 Set the line direction and length based on a target point relative to the current origin.
int a_line2_setv (a_line2 *ctx, a_point2 const *p, a_vector2 const *v)
 initialize the line segment from a start point and a direction vector.
int a_line2_set (a_line2 *ctx, a_point2 const *p, a_point2 const *q)
 initialize the line segment from two points (start point p, end point q).
void a_line2_eval (a_line2 const *ctx, a_real w, a_point2 *res)
 evaluate a point on the line at a given parameter.
a_real a_line2_parm (a_line2 const *ctx, a_point2 const *rhs)
 compute the scalar projection parameter of a point onto the infinite line.
a_real a_line2_proj (a_line2 const *ctx, a_point2 const *rhs, a_point2 *res)
 project a point onto the infinite line.
a_real a_line2_limparm (a_line2 const *ctx, a_real min, a_real max, a_point2 const *rhs)
 compute the scalar projection parameter of a point onto the line segment.
a_real a_line2_limproj (a_line2 const *ctx, a_real min, a_real max, a_point2 const *rhs, a_point2 *res)
 project a point onto a line segment.
a_real a_line2_sdist (a_line2 const *ctx, a_point2 const *rhs)
 compute the signed distance from a point to the infinite line.
a_real a_line2_dist (a_line2 const *ctx, a_point2 const *rhs)
 compute the absolute distance from a point to the infinite line.
a_real a_line2_limdist (a_line2 const *ctx, 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 a_line2_limdist2 (a_line2 const *ctx, 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 a_line2_segdist (a_line2 const *ctx, 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)
 compute the distance between two line segments.
a_real a_line2_segdist2 (a_line2 const *ctx, 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)
 compute the squared distance between two line segments.
int a_line2_int0 (a_line2 const *ctx, a_real min, a_real max, a_point2 const *rhs, a_real *w)
 compute the intersection between a point and a line segment.
int a_line2_int1 (a_line2 const *ctx, a_real min1, a_real max1, a_line2 const *rhs, a_real min2, a_real max2, a_real *w1, a_real *w2)
 compute the intersection between two line segments.
void a_line2_rot_ (a_line2 const *ctx, a_point2 const *rhs, a_real sin, a_real cos, a_line2 *res)
 rotate a line segment around a pivot point using pre-calculated sine and cosine values.
void a_line2_rot (a_line2 const *ctx, a_point2 const *rhs, a_real angle, a_line2 *res)
 rotate a line segment around a specified pivot point.

Detailed Description

two-dimensional line