Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

geomlib/ellipse.h File Reference

GEOMLIB - Ellipses and elliptic arcs. More...

#include "geomlib/curve.h"
#include "geomlib/vector.h"

Go to the source code of this file.

Defines

#define geom_elliptic_arc_VMT   geom_curve_VMT
#define geom_elliptic_arc_INIT

Functions

 GEOM_CLASS_HEAD (elliptic_arc, curve)
void geom_elliptic_arc_create (struct geom_elliptic_arc *arc)
void geom_elliptic_arc_destroy (struct geom_elliptic_arc *arc)
void geom_elliptic_arc_after_change (struct geom_elliptic_arc *arc)
void geom_elliptic_arc_copy (struct geom_elliptic_arc *arc, struct geom_elliptic_arc *src)
void geom_elliptic_arc_set (struct geom_elliptic_arc *arc, struct geom_point *center, real rotation, real a_radius, real b_radius, real start, real dif)
 Sets elliptic arc from given center point, rotation, radii and endpoints angles.

void geom_elliptic_arc_set_closed (struct geom_elliptic_arc *arc, struct geom_point *center, real rotation, real a_radius, real b_radius)
 Sets entire ellipse from given center point, rotation and radii.

int geom_elliptic_arc_set_endpoints (struct geom_elliptic_arc *arc, struct geom_point *start, struct geom_point *end, struct geom_point *mid, real st, real dif, uns flags)
 Sets new endpoints to ellipse or elliptic arc.

int geom_elliptic_arc_from_foci_major (struct geom_elliptic_arc *arc, struct geom_point *focus1, struct geom_point *focus2, real major)
 Sets the ellipse from 2 foci and major axis.

int geom_elliptic_arc_from_foci_point (struct geom_elliptic_arc *arc, struct geom_point *focus1, struct geom_point *focus2, struct geom_point *point)
 Sets the ellipse from 2 foci going through given point.

int geom_elliptic_arc_from_3_points_smallest (struct geom_elliptic_arc *arc, struct geom_point *point1, struct geom_point *point2, struct geom_point *point3)
 Sets the ellipse with smallest area going through 3 given points.

int geom_elliptic_arc_from_3_points_circle (struct geom_elliptic_arc *arc, struct geom_point *point1, struct geom_point *point2, struct geom_point *point3)
 Sets the ellipse to be circle going through 3 given points.

int geom_elliptic_arc_from_3_points_rotation_eccentricity (struct geom_elliptic_arc *arc, struct geom_point *point1, struct geom_point *point2, struct geom_point *point3, real rotation, real eccentricity)
 Sets the ellipse from 3 points, rotation and eccentricity.

int geom_elliptic_arc_from_center_point_circle (struct geom_elliptic_arc *arc, struct geom_point *center, struct geom_point *point)
 Sets the ellipse to be circle with given center and one point.

int geom_elliptic_arc_from_center_point_rotation_eccentricity (struct geom_elliptic_arc *arc, struct geom_point *center, struct geom_point *point, real rotation, real eccentricity)
 Sets the ellipse with given center, one point, rotation and eccentricity.

real geom_elliptic_arc_time_to_btime (struct geom_elliptic_arc *arc, struct geom_expansion *expansion, real time)
real geom_elliptic_arc_btime_to_time (struct geom_elliptic_arc *arc, struct geom_expansion *expansion, real btime)
int geom_elliptic_arc_expansion_append (struct geom_elliptic_arc *arc, struct geom_fpath *path)
int geom_elliptic_arc_to_bezier (struct geom_elliptic_arc *arc, struct geom_bezier *bezier)
int geom_elliptic_arc_conversion_append (struct geom_elliptic_arc *arc, uns flags, struct geom_fpath *result)
int geom_elliptic_arc_from_arc (struct geom_elliptic_arc *elliptic_arc, struct geom_arc *arc)
 Converts circular arc to elliptic arc.

int geom_elliptic_arc_to_poly (struct geom_elliptic_arc *arc, real poly[6])
 Converts ellipse to form Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0.

int geom_elliptic_arc_transform (struct geom_elliptic_arc *arc, struct geom_transform *transform, struct geom_elliptic_arc *result)
 Apply affine transformation to given elliptic arc.

int geom_elliptic_arc_normalize (struct geom_elliptic_arc *arc)
 Normalize elliptic arc structure.

int geom_elliptic_arc_point_start (struct geom_elliptic_arc *arc, struct geom_point *result)
 Returns starting point of given elliptic arc.

int geom_elliptic_arc_point_end (struct geom_elliptic_arc *arc, struct geom_point *result)
 Returns ending point of given elliptic arc.

int geom_elliptic_arc_points (struct geom_elliptic_arc *arc, struct geom_point *start, struct geom_point *end)
 Returns starting and ending points of given elliptic arc.

int geom_elliptic_arc_point_at_time (struct geom_elliptic_arc *arc, real time, struct geom_point *result)
 Returns point of given elliptic arc.

int geom_elliptic_arc_derivation_start (struct geom_elliptic_arc *arc, struct geom_vector *result)
 Returns first derivation in starting point of given elliptic arc.

int geom_elliptic_arc_derivation_end (struct geom_elliptic_arc *arc, struct geom_vector *result)
 Returns first derivation in ending point of given elliptic arc.

int geom_elliptic_arc_derivation_at_time (struct geom_elliptic_arc *arc, real time, struct geom_vector *result)
 Returns first derivation in point of given elliptic arc.

int geom_elliptic_arc_is_closed (struct geom_elliptic_arc UNUSED *arc)
 Returns whether the structure contains entire ellipse.

int geom_elliptic_arc_is_singular (struct geom_elliptic_arc *arc)
 Returns whether the elliptic arc is singular (zero radius or radii).

real geom_elliptic_arc_semimajor (struct geom_elliptic_arc *arc)
 Returns semimajor axis of given ellipse.

real geom_elliptic_arc_semiminor (struct geom_elliptic_arc *arc)
 Returns semiminor axis of given ellipse.

real geom_elliptic_arc_eccentricity (struct geom_elliptic_arc *arc)
 Returns eccentricity of given ellipse.

real geom_elliptic_arc_focal_parameter (struct geom_elliptic_arc *arc)
 Returns focal parameter of given ellipse (distance of focus to directrix).

int geom_elliptic_arc_foci (struct geom_elliptic_arc *arc, struct geom_point *focus1, struct geom_point *focus2)
 Returns foci of given ellipse.

int geom_elliptic_arc_directrices (struct geom_elliptic_arc *arc, struct geom_point *point1, struct geom_point *point2, struct geom_vector *vector)
 Returns directrices of given ellipse.

real geom_elliptic_arc_point_error (struct geom_elliptic_arc *arc, struct geom_point *point)
 Returns value near zero for points near the ellipse.

int geom_elliptic_arc_bbox (struct geom_elliptic_arc *arc, struct geom_rectangle *bbox)


Detailed Description

GEOMLIB - Ellipses and elliptic arcs.

See also:
Ellipses and elliptic arcs
Copyright (c) 2004-2005 The VRR Team <vrr@ucw.cz> This program is distributed under GNU General Public License, see COPYING.

Define Documentation

#define geom_elliptic_arc_INIT
 

Value:

geom_curve_INIT \
        \
        .time_to_btime = (real (*)(void *, struct geom_expansion *, real)) &geom_elliptic_arc_time_to_btime, \
        .btime_to_time = (real (*)(void *, struct geom_expansion *, real)) &geom_elliptic_arc_btime_to_time, \
        \
        .expansion_append = (int (*)(void *, struct geom_fpath *)) &geom_elliptic_arc_expansion_append, \
        .to_bezier = (int (*)(void *, struct geom_bezier *)) &geom_elliptic_arc_to_bezier, \
        .conversion_append = (int (*)(void *, uns, struct geom_fpath *)) &geom_elliptic_arc_conversion_append, \


Function Documentation

int geom_elliptic_arc_derivation_at_time struct geom_elliptic_arc arc,
real  time,
struct geom_vector result
 

Returns first derivation in point of given elliptic arc.

Parameters:
arc Elliptic arc.
time TIME parameter.
result Resulting derivation vector.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_derivation_end struct geom_elliptic_arc arc,
struct geom_vector result
 

Returns first derivation in ending point of given elliptic arc.

Parameters:
arc Elliptic arc.
result Resulting derivation vector.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_derivation_start struct geom_elliptic_arc arc,
struct geom_vector result
 

Returns first derivation in starting point of given elliptic arc.

Parameters:
arc Elliptic arc.
result Resulting derivation vector.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_directrices struct geom_elliptic_arc arc,
struct geom_point point1,
struct geom_point point2,
struct geom_vector vector
 

Returns directrices of given ellipse.

Parameters:
arc Ellipse.
point1 Rotated point on right directrix (possibly NULL).
point2 Rotated point on left directrix (possibly NULL).
vertex Direction vector of directrices, ellipse is to the left of vector from point1 (possibly NULL).
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

real geom_elliptic_arc_eccentricity struct geom_elliptic_arc arc  )  [inline, static]
 

Returns eccentricity of given ellipse.

Parameters:
arc Ellipse.
Return values:
finite Eccentricity (in interval [0, 1]).
otherwise Numeric error.

real geom_elliptic_arc_focal_parameter struct geom_elliptic_arc arc  )  [inline, static]
 

Returns focal parameter of given ellipse (distance of focus to directrix).

Parameters:
arc Ellipse.
Return values:
finite Focal parameter (>=0).
otherwise Numeric error.

int geom_elliptic_arc_foci struct geom_elliptic_arc arc,
struct geom_point focus1,
struct geom_point focus2
 

Returns foci of given ellipse.

Parameters:
arc Ellipse.
focus1 Rotated right (possibly NULL).
focus2 Rotated left focus (possibly NULL).
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_from_3_points_circle struct geom_elliptic_arc arc,
struct geom_point point1,
struct geom_point point2,
struct geom_point point3
 

Sets the ellipse to be circle going through 3 given points.

Parameters:
arc Resulting ellipse (initialized).
point1 First point.
point2 Second point.
point3 Third point.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_from_3_points_rotation_eccentricity struct geom_elliptic_arc arc,
struct geom_point point1,
struct geom_point point2,
struct geom_point point3,
real  rotation,
real  eccentricity
 

Sets the ellipse from 3 points, rotation and eccentricity.

Parameters:
arc Resulting ellipse (initialized).
point1 First point.
point2 Second point.
point3 Third point.
rotation Rotation of major axis.
eccentricity Ellipse eccentricity.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_from_3_points_smallest struct geom_elliptic_arc arc,
struct geom_point point1,
struct geom_point point2,
struct geom_point point3
 

Sets the ellipse with smallest area going through 3 given points.

Parameters:
arc Resulting ellipse (initialized).
point1 First point.
point2 Second point.
point3 Third point.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_from_arc struct geom_elliptic_arc elliptic_arc,
struct geom_arc arc
 

Converts circular arc to elliptic arc.

Parameters:
elliptic_arc Resulting elliptic arc.
arc Circular arc to convert.
Return values:
zero Always.

int geom_elliptic_arc_from_center_point_circle struct geom_elliptic_arc arc,
struct geom_point center,
struct geom_point point
 

Sets the ellipse to be circle with given center and one point.

Parameters:
arc Resulting ellipse (initialized).
center Center.
point Point.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_from_center_point_rotation_eccentricity struct geom_elliptic_arc arc,
struct geom_point center,
struct geom_point point,
real  rotation,
real  eccentricity
 

Sets the ellipse with given center, one point, rotation and eccentricity.

Parameters:
arc Resulting ellipse (initialized).
center Center.
point Point.
rotation Rotation of major axis.
eccentricity Ellipse eccentricity.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_from_foci_major struct geom_elliptic_arc arc,
struct geom_point focus1,
struct geom_point focus2,
real  major
 

Sets the ellipse from 2 foci and major axis.

If axis is too short, resulting ellipse is singular.

Parameters:
arc Resulting ellipse (initialized).
focus1 First focus.
focus2 Second focus.
major Length of major axis (>=0).
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_from_foci_point struct geom_elliptic_arc arc,
struct geom_point focus1,
struct geom_point focus2,
struct geom_point point
 

Sets the ellipse from 2 foci going through given point.

Parameters:
arc Resulting ellipse (initialized).
focus1 First focus.
focus2 Second focus.
point Point on resulting ellipse.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_is_closed struct geom_elliptic_arc UNUSED *  arc  )  [inline, static]
 

Returns whether the structure contains entire ellipse.

Parameters:
arc Ellipse or elliptic arc.
Return values:
nonzero Ellipse.
zero Elliptic arc.

int geom_elliptic_arc_is_singular struct geom_elliptic_arc arc  )  [inline, static]
 

Returns whether the elliptic arc is singular (zero radius or radii).

Parameters:
arc Elliptic arc.
Return values:
nonzero Elliptic arc is singular.
zero Elliptic arc is not singular.

int geom_elliptic_arc_normalize struct geom_elliptic_arc arc  ) 
 

Normalize elliptic arc structure.

Input:

  • rotation, a_radius, b_radius, start and dif must be finite Output:
  • rotation in [0, R_PI]
  • a_radius >= b_radius
  • start in [0, R_2PI]
  • dif in [-R_2PI, R_2PI]

Parameters:
arc Elliptic arc to normalize.
Return values:
zero Always.

int geom_elliptic_arc_point_at_time struct geom_elliptic_arc arc,
real  time,
struct geom_point result
 

Returns point of given elliptic arc.

Parameters:
arc Elliptic arc.
time TIME parameter.
result Resulting point.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_point_end struct geom_elliptic_arc arc,
struct geom_point result
 

Returns ending point of given elliptic arc.

Parameters:
arc Elliptic arc.
result Resulting ending point.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

real geom_elliptic_arc_point_error struct geom_elliptic_arc arc,
struct geom_point point
 

Returns value near zero for points near the ellipse.

Parameters:
arc Ellipse.
point Point to test.
Return values:
~zero Point is near the ellipse.
~nonzero Point is far from the ellipse.
not_finite Numeric error.

int geom_elliptic_arc_point_start struct geom_elliptic_arc arc,
struct geom_point result
 

Returns starting point of given elliptic arc.

Parameters:
arc Elliptic arc.
result Resulting starting point.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_points struct geom_elliptic_arc arc,
struct geom_point start,
struct geom_point end
 

Returns starting and ending points of given elliptic arc.

Parameters:
arc Elliptic arc.
start Resulting starting point.
end Resulting ending point.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

real geom_elliptic_arc_semimajor struct geom_elliptic_arc arc  )  [inline, static]
 

Returns semimajor axis of given ellipse.

Parameters:
arc Ellipse.
Return values:
finite Semimajor axis.

real geom_elliptic_arc_semiminor struct geom_elliptic_arc arc  )  [inline, static]
 

Returns semiminor axis of given ellipse.

Parameters:
arc Ellipse.
Return values:
finite Semiminor axis.

void geom_elliptic_arc_set struct geom_elliptic_arc arc,
struct geom_point center,
real  rotation,
real  a_radius,
real  b_radius,
real  start,
real  dif
 

Sets elliptic arc from given center point, rotation, radii and endpoints angles.

Parameters:
arc Resulting elliptic arc (initialized).
center Center point.
rotation CCW rotation around the center point.
a_radius First radius (>=0).
b_radius Second radius (>=0).
start Angle of starting point in unit circle.
dif CCW angles difference in unit circle.
Return values:
zero Always.

void geom_elliptic_arc_set_closed struct geom_elliptic_arc arc,
struct geom_point center,
real  rotation,
real  a_radius,
real  b_radius
[inline, static]
 

Sets entire ellipse from given center point, rotation and radii.

Parameters:
arc Resulting elliptic arc (initialized).
center Center point.
rotation CCW rotation around the center point.
a_radius First radius (>=0).
b_radius Second radius (>=0).
Return values:
zero Always.

int geom_elliptic_arc_set_endpoints struct geom_elliptic_arc arc,
struct geom_point start,
struct geom_point end,
struct geom_point mid,
real  st,
real  dif,
uns  flags
 

Sets new endpoints to ellipse or elliptic arc.

Parameters:
arc Ellipse or elliptic arc.
start Point very near to ellipse (or NULL).
end Point very near to ellipse (or NULL).
mid Point very near to ellipse (or NULL).
dif Angle difference, if needed.
flags Flags describing the arc to select (see GEOM_CONIC_ARC_...).
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_to_poly struct geom_elliptic_arc arc,
real  poly[6]
 

Converts ellipse to form Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0.

Parameters:
arc Elliptic arc to convert.
poly Resulting coefficents.
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.

int geom_elliptic_arc_transform struct geom_elliptic_arc arc,
struct geom_transform transform,
struct geom_elliptic_arc result
 

Apply affine transformation to given elliptic arc.

Parameters:
arc Elliptic arc to transform.
transform Affine transformation.
result Resulting elliptic arc (possibly result = arc).
Return values:
zero Success.
GEOM_ERR_NUMERIC Numeric error.


Generated on Tue Dec 9 16:30:09 2008 for Vrr by doxygen 1.3.5