next up previous contents
Next: Curve Geometry Up: Geometrical Primitives Previous: Point Geometry   Contents

Line Geometry

Line geometry in 2D and 3D is represented by the line2 and line3 data structures respectively. These are of the form

typedef struct line2
{
    Ts_id ts_id;                /* Tina structure identifier */
    unsigned int type;
    unsigned int label;
    struct vec2 p1,p2;
    struct vec2 p, v;
    float length;
    struct list *props;
} Line2;

typedef struct line3
{
    Ts_id ts_id;                /* Tina structure identifier */
    unsigned int type;
    unsigned int label;
    struct vec3 p1,p2;   /* end points */
    struct vec3 p;
    struct vec3 v;
    float length;
    struct list *props;
} Line3;

Where p1 and p2 are the endpoints of the line, and v is the unit vector in the direction of the vector from p1 to p2. The length field is the magnitude of this vecto
p specifies an additional point on the line eg the mid point, or its point of closest approach to the origin, etc) which may be of use in a number of applications.

Line2  *line2_alloc(unsigned int type)

Line3  *line3_alloc(unsigned int type)

Line2  *line2_make(Vec2 p1, Vec2 p2, unsigned int type)

Line3  *line3_make(Vec3 p1, Vec3 p2, int type)

void    line3_remake(Line3 * line, int type)

Line2  *line2_copy(Line2 * line)

Line3  *line3_copy(Line3 * line)  /* identical copy that shares proplist */

Line3  *line3_clone(Line3 * line) /* identical copy with null proplist */

void    line2_free(Line2 * line)

void    line3_free(Line3 * line)

void   line2_format(Line2 *line)

void   line3_format(Line3 *line)

Functions for manipulating line geometry. The functions line2_copy, line3_copy, line2_free and line3_free copy and free the property list see proplist description for details).
The functions line2_format and line3_format produces a standard formatted output of line geometry using the standard Tina format facility. Usually directed to the top level text display window.

Line2  *line2_negative(Line2 * line)

Line3  *line3_negative(Line3 * line)

void    line2_negate(Line2 * line)

void    line3_negate(Line3 * line)

Line2  *line2_proj(Line2 * line, Mat3 proj)

Line2  *line2_rectify(Line2 * line, Mat3 rect)

void    line3_transform(Line3 * line, Transform3 trans)

int     line3_coincident(Line3 * l1, Line3 * l2, double doterror,
                         double poserror)

Bool    line2_point_on_line(Line2 * line, Vec2 p, double thres)

Transformation functions for line geometry. The negate functions change the labeling of the end points of the line and the direction of the vector that connects them.

line2_proj performs a projective transformation of the geometry in line according to the 3X3 projection matrix proj_mat and return a pointer to the transformed version.

line2_transform and line3_transform apply the rotation and translation trans directly to the line geometry structure.

line2_coincident and line3_coincident check if l1 and l2 are spatially coincident within the allowed position and rotation errors poserror and roterror respectively.


next up previous contents
Next: Curve Geometry Up: Geometrical Primitives Previous: Point Geometry   Contents
root 2017-11-23