ut_geo2d.c File Reference


Detailed Description

2D-GEOMETRIC FUNCTIONS UT2D_

=====================================================
Liste_Funktionen_Beginn:

----------------------------------------------------
-------------- 1D ----------------------------------
----------------------------------------------------
UT1D_ndb_npt_bp           copy the backplane-part of a pointTable


----------------------------------------------------
-------------- 2D ----------------------------------
----------------------------------------------------
UT_RADIANS                angle (radians) = angle (degrees) (inline)
UT_DEGREES                angle (degrees) = angle (radians) (inline)
UT2D_angr_set             change to val >= 0 <= RAD_360
UT2D_2angr_set            change to consecutive vals from -RAD_360 to RAD_360
UT2D_angr_2angr           angle between 2 angles
UT2D_ptNr_ci              Anzahl Ecken circ berechnen
UT2D_comp2angd_p          compare 2 angles (deg) for parallel



-------------- triangles ----------------------------------
UT2D_solvtriri_a          right-angled tri: a from sides b and c
UT2D_solvtriri_c_abfc     scalene tri: c from a and x; b=x*c
UT2D_solvtriri_ac         right-angled tri: q and hc from sides b and c
UT2D_solvtri_abc          scalene tri: q and hc from sides a, b and c


-------------- side -------------------------------------
UT2D_sid_2vc              check vc for left (CCW, above) or right (CW, below)
UT2D_sidPerp_2vc          check vc for inFront, perp.(normal), or behind
UT2D_sid_3pt              compare if pt is on, above or below line (p1-p2)
UT2D_sid_ptvc             compare if pt is on, above or below line (pt+vc)
UT2D_sidPerp_3pt          check if p3 is in, before or behind perp-line tru p2
UT2D_sidPerp_ptvc         compare if pt is right/on/left of a normal to pt+vc


-------------- angles -------------------------------------
UT2D_crossprod_2vc        crossprod of 2 2D-Vectors
UT2D_acos_2vc             cos of opening angle of 2 vecs (dot=scalarprod)
UT2D_angr_angd            angle (radians) = angle (degrees)
UT2D_angd_angr            angle (degrees) = angle (radians)
UT2D_angd_invert          ang(deg.) invert (change direction)
UT2D_angr_triri_ab        right-angled tri: angle alfa from sides a and b
UT2D_angr_ptpt            angle (radians) = pt > pt
UT2D_angr_vc              angle (radians) = vector (0-360)
UT2D_angr_2ln             angle (rad.) between 2 Lines
UT2D_angr_2vc             angle (rad.) between 2 Vectors
UT2D_angr_3ptdr           Oeffnungswinkel von 2 Vektoren entspr. Umlaufsinn
UT2D_angr_ci              openingAngle of circle (pa,pe,pc,rad/dreh)
UT2D_angr_perpangr        angle + 90 degree (perp. to angle)

-------------- length -------------------------------------
UT2D_len_vc               length of 2D-vector             INLINE
UT2D_lenq_vc              Quadr.Vectorlength              INLINE
UT2D_len_2pt              distance pt - pt
UT2D_lenB_2pt             dx/dy-Box-distance point-point  (fast!)
UT2D_lenq_2pt             quadr. distance pt - pt         INLINE
UT2D_len_ptln             minimal dist. from point to line
UT2D_3len_ptln            minimal dist. from point to line + normalDist
UT2D_slenq_ptptvc         signed quadr.Distance pt-pt in Richtung vec
UT2D_slen_nor3pt          signed length of normal point - line
UT2D_slen_norvc2pt        signed length of normal vector - vector
UT2D_minLenB_4pt          min lenght between 2 lines
UT2D_len_ptlnX            Laengsabst.(m.Vorz.) eines Punktes auf Linie (pl-vl)
UT2D_len_ptlnY            Normalabst.(m.Vorz.) eines Punktes von Linie (pl-vl)
UT2D_nlenq_3pt            give quadr.Distance from point to line
UT2D_2len_ptvc            dx,dy = dist pt - pb along / normal to vector vc
UT2D_len_cir              length circular arc (pa,pe,pc,rad/dreh)
UT2D_len_cia              length arc (from rad & angle)        INLINE

-------------- parameter -------------------------------------
UT2D_parLn_pt2pt          get parameter (0-1) of point px along line p1-p2

-------------- area --------------------------------------
UT2D_ar_3pt               get (signed) area of triangle

-------------- points --------------------------------------
UT2D_comp2pt              compare 2 2D-points
UT2D_comp4pt              compare 4 2D-points
UT2D_pt_ck_onLine         check if point is on 2D-linesegment
UT2D_pt_ck_inLine         check 2D-point on line segment or beyond limits
UT2D_pt_ck_inplg          Test if Point ptx is inside polygon pTab
UT2D_pt_ck_linear         check straightness of points (if points are linear)
UT2D_pt_cknear_npt        return index of nearest Point from n points
UT2D_pt_ck_in3pt          check if px is between lines po-p1, po-p2
UT2D_pt_ck_inpt2vc        check if px is between vectors po-v1, po-v2
UT2D_pt_ck_inAc           check if pt is in Arc(Segment)
UT2D_pt_ck_inCv3          check if point is inside polygon
UT2D_pt_ck_int4pt         check if 2 lines intersect/touch
UT2D_i4pt_npt             find indices of extreme-points;

UT2D_pt_pt                2D-Point = 3D-Point                          INLINE
UT2D_pt_pt3               2D-Point = 3D-Point                          INLINE
UT2D_pt_2db               2D-Point = 2 doubles (x, y)                  INLINE
UT2D_pt_pt3bp             2D-Point = 3D-Point on Backplane (inline)
UT2D_pt_addpt             Add two points:      po += p1                INLINE
UT2D_pt_opp2pt            opposite point (p1 = center)
UT2D_pt_mid2pt            midpoint between 2 points
UT2D_pt_traptvc           2D-Point = 2D-Point + 2D-Vector     INLINE
UT2D_pt_tra2ptlen         transl. point p1 into dir p1 -> p2 dist. lenv
UT2D_pt_traPtPtPar        transl. pt with parameter along p1-p2
UT2D_pt_tra3ptlen         transl. point p1 into dir p2 -> p3 dist. lenv
UT2D_pt_tra2pt2len        transl. point into dir p1 -> p2 dist. dx and normal dy
UT2D_pt_tra2pt3len        dir=from p1 on p1->p2 offset dx and normal dy; length
UT2D_pt_traptvclen        transl. point into dir vc dist. lenv
UT2D_pt_traptangrlen      transl. point into dir ang dist. lenv
UT2D_pt_tranor2ptlen      transl. point normal to p1 - p2 dist. lenv
UT2D_pt_tranorptvclen     transl. point normal to vec dist. lenv
UT2D_pt_traptvc2len       transl. point into dir vc dist. dx and normal dy
UT2D_pt_tracirlen         transl. point circular length
UT2D_pt_rotptangr         rotate a point around centerpoint
UT2D_pt_projptptvc        point = project point to line (pt+vc)
UT2D_pt_projpt2pt         pp = project point pt to lineSegment p1-p2
UT2D_pt_projptln          point = project point to line
UT2D_2pt_projptci         project point to circle
UT2D_pt_projptci          project point to Arc (segment of circle)
UT2D_pt_int4pt            intersection 2 lines
UT2D_pt_intptvcy          intersection line (pt-vc) - horizontal line
UT2D_pt_intlny            intersection linesegment - horizontal line
UT2D_pt_intlnx            intersection linesegment - vertical line
UT2D_pt_intlnln           intersect Line x Line; both limited or unlimited
UT2D_pt_int2ln            point = intersection of 2 lines
UT2D_pt_int2pt2vc         point = intersection of 2 vectors + 2 Points
UT2D_pt_int2vc2pt         point = intersection of 2 vectors + 2 Points
UT2D_2pt_intciptvc        intersect Circle - Line (pt+vc); both unlimited
UT2D_2pt_intlnci          intersect Line x Circ; both limited or unlimited
UT2D_2pt_intcici          intersect 2 (unlimited) Circles
UT2D_2pt_int2ci           intersect Circ x Circ; both limited or unlimited
UT2D_pt_traptm2           einen 2D-Punkt mit 3x2-Matrix transformieren
UT2D_pt_obj2              2D-Obj > 2D-Point
UT2D_pt_traptm3           apply transformation to point (from 4x3-matrix)


-------------- lines -------------------------------------
UT2D_ln_ptpt              2D-Line from 2 2D-points                   INLINE
UT2D_ln_ptvc              2D-Line from 2D-point and 2D-vector        INLINE
UT2D_ln_ln3               2D-Line aus 3D-Line
UT2D_ln_4db               2D-Line from 4 doubles
UT2D_ln_obj2              2D-Obj > 2D-Line
UT2D_lncoe_ln             coefficients of 2D Line (k, d)
UT2D_ln_pts_dmax          line <-- points with max. distance of pointTab
UT3D_ln_inv               invert (change p1, p2)

UT2D_ptvc_ck_int2pt       check if Line|Ray Pt-Vec intersects Line Pt-Pt


-------------- vectors -------------------------------------
UT2D_comp2vc              compare 2 vectors for parallel and antiparallel
UT2D_comp2vc_p            compare 2 vectors for parallel
UT2D_ckvc_in2vc           check if v2 is between v1 and v3
UT2D_2parvc_3vc           project end of vec1 along vec2 on vec3
UT2D_vc_2db               2D-Vector = 2 doubles (x, y)
UT2D_vc_angr              2D-Vector =  angle (radians)
UT2D_vc_angrlen           2DVector =  angle (radians) + Length
UT2D_vc_vc3BP             2D-Vector = 3D-Vector on Backplane (inline)
UT2D_vc_2pt               2D-Vector = 2D-Point -> 2D-Point   INLINE
UT2D_vc_2pt3              2D-Vector = 3D-Point -> 3D-Point
UT2D_vc_2pt3_bp           2D-Vector = (3D-Point -> 3D-Point) on Backplane
UT2D_vc_2ptlen            2D-Vector = 2D-Point -> 2D-Point, set Length
UT2D_vc_ln                2D-Vector = 2D-LineStartPoint -> 2D-LineEndPoint
UT2D_vc_cipt              Tang.Vektor an einem Punkt pt des Kreises errechnen
UT2D_vc_invert            2D-Vector invert (change direction)
UT2D_vc_add2vc            v3 = v1 + v2                ADD           INLINE
UT2D_vc_sub2vc            v3 = v1 - v2                SUB           INLINE
UT2D_vc_multvc            vo = vi * d                 MULT          INLINE
UT2D_vc_perpvc            vector = perpendic. to vector ( + 90 degrees)
UT2D_vc_perp2pt           vector = perpendic. to Line ( + 90 degrees)
UT2D_vc_normalize         change to length 1
UT2D_vc_setLength         change 2D-Vectorlength
UT2D_vc_mid2vc            vector = middle between 2 vectors
UT2D_vc_merge2vc          merge 2 vectors   vNew = (v1 + v2) / 2
UT2D_vc_rotangr           rotate a 2D_vector
UT2D_vc_travcm2           2D-vector transformation (3x2-matrix)

-------------- circs --------------------------------------
UT2D_angr_ciSec           opening angle of Secant of Circ
UT2D_len_ciSec            cmp length of secant from radius + heght of secant
UT2D_compPtOnAc           is Point on Arc
UT2D_ci_ci3               2D-Circ = 3D-Circ
UT2D_ci_ptrd              360-deg 2D-Circ from center, radius
UT2D_ci_pt2vcrd           circ from center, 2 vectors & radius
UT2D_ci_ptvcpt            durch Punkt+Richtung, durch 2. Punkt
UT2D_ci_ptvcptvc          durch Punkt+Richtung, tangential an Linie (pt+vc)
UT2D_ci_ptvcci            durch Punkt+Richtung, tangential an Circ (pc+r)
UT2D_ci_obj2              2D-Circ = 2D-ObjG
UT2D_ci_2vc2ptrd          2D-Circ; verrundet 2 Lines; 4 Lösungen
UT2D_ci_ciptvcrd          2D-Circ; verrundet Circ/Line; 4 Lösungen

-------------- GrafObj - (see also UTO_) ---------------
UT2D_obj_obj3             change 3D-Obj > 2D-Obj (remove Z-val)
UT2D_obj_pt3              change 3D-Point > 2D-Obj
UT2D_obj_ln3              change 3D-Line > 2D-Obj
UT2D_obj_ci2              change 2D-Circ > 2D-Obj
UT2D_obj_ci3              change 3D-Circ > 2D-Obj
UT2D_obj_cv3              change 3D-Curv > 2D-Obj

UT2D_void_obj2            change ObjG2-Objekt -> data-Obj

-------------- polygon --------------------------------
UT2D_cv_ci                change circle > polygon (schnell)  DO NOT USE
UT2D_cv_ci_               get circular polygon from circle
UT2D_cv_ln                Linearstueck -> Polygon / Anzahl
UT2D_npt_ci               circular polygon
UT2D_cv_cin               Circ -> Polygon / Anzahl
UT2D_cv_ci360             Vollkreis --> Polygon
UT2D_cv_inv               Punktetabelle umdrehen
UT2D_cv3_linear           delete unnecesary straight points
UT2D_srar_polc            Umlaufsinn und Flaeche eines closed polygon
UT2D_srar_inpt3           Umlaufsinn und Flaeche eines indexed closed polygon

-------------- transformation ------------------------------
UT2D_m2_load              2D-Achsensystem (Verdrehvektor, Ori.) into 3x2 Mat
UT2D_m2_loadtravcm2       load 2D-vector trafo (3x2 matrix)
UT2D_m2_invtravcm2        invert 2D-vector transformation
UT2D_m3_init_rot          Initialize a 3x2 - matrix with rotation

Liste_Funktionen_Ende:
=====================================================

#include "../xa/MS_Def0.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "../gr/ut_UI.h"
#include "../ut/ut_geo.h"
#include "../ut/ut_math.h"
#include "../ut/ut_bspl.h"
#include "../ut/ut_plg.h"
#include "../ut/ut_elli.h"
#include "../ut/ut_TX.h"
#include "../ut/ut_umem.h"
#include "../ut/ut_geo_const.h"
#include "../ut/ut_tol_const.h"
#include "../ut/ut_const.h"

Functions

int UT2D_ptvc_ck_int2pt (int mode, Point2 *p1s, Vector2 *v1, Point2 *p2s, Point2 *p2e)
int UT1D_ndb_npt_bp (double *da, Point *pa, int pNr, int bp)
int UT2D_angr_set (double *angr)
int UT2D_2angr_set (double *ang1, double *ang2, int irot)
double UT2D_angr_2angr (double ang1, double ang2, int irot)
int UT2D_comp2angd_p (double d1, double d2, double tol)
int UT2D_solvtriri_a (double *a, double b, double c)
int UT2D_solvtriri_c_abfc (double *c, double a, double x)
int UT2D_solvtriri_ac (double *q, double *hc, double b, double c)
int UT2D_solvtri_abc (double *q, double *hc, double a, double b, double c)
int UT2D_sidPerp_3pt (Point2 *p1, Point2 *p2, Point2 *p3)
double UT2D_angr_angd (double angd)
double UT2D_angd_angr (double angr)
double UT2D_angd_invert (double *andi)
double UT2D_angr_triri_ab (double b, double a)
double UT2D_angr_ptpt (Point2 *pt1, Point2 *pt2)
double UT2D_angr_vc (Vector2 *vc)
double UT2D_angr_2ln (Line2 *ln1, Line2 *ln2)
double UT2D_angr_2vc (Vector2 *vc1i, Vector2 *vc2i)
double UT2D_angr_3ptdr (Point2 *pa, Point2 *pe, Point2 *pc, int dreh)
double UT2D_len_2pt (Point2 *p1, Point2 *p2)
double UT2D_len_ptln (Point2 *pt, Point2 *pa, Point2 *pe)
int UT2D_3len_ptln (double *d1, double *dx, double *dy, Point2 *pt, Point2 *pa, Point2 *pe)
int UT2D_slenq_ptptvc (double *qlen, Point2 *pa, Point2 *pb, Point2 *pc)
double UT2D_slen_nor3pt (Point2 *p1, Point2 *p2, Point2 *p3)
double UT2D_slen_norvc2pt (Vector2 *v1, Point2 *p1, Point2 *p2)
int UT2D_nlenq_3pt (double *qlen, Point2 *pa, Point2 *pb, Point2 *pc)
int UT2D_parLn_pt2pt (double *d1, Point2 *p1, Point2 *p2, Point2 *px)
void UT2D_2len_ptvc (double *dx, double *dy, Point2 *pt, Point2 *pb, Vector2 *vc)
double UT2D_angr_ci (Point2 *pa, Point2 *pe, Point2 *pc, double rad_in)
double UT2D_angr_perpangr (double *ai)
double UT2D_len_cir (double *angOpe, Point2 *pa, Point2 *pe, Point2 *pc, double rad_in)
double UT2D_len_ptlnX (Point2 *pt, Point2 *pl, Vector2 *vl)
double UT2D_len_ptlnY (Point2 *pt, Point2 *pl, Vector2 *vl)
int UT2D_sid_3pt (Point2 *pt, Point2 *p1, Point2 *p2)
int UT2D_sid_ptvc (Point2 *pt, Point2 *pl, Vector2 *vl)
int UT2D_sidPerp_ptvc (Point2 *pt, Point2 *pl, Vector2 *vl)
int UT2D_comp4pt (Point2 *p1a, Point2 *p1e, Point2 *p2a, Point2 *p2e, double tol)
void UT2D_pt_tra2ptlen (Point2 *po, Point2 *p1, Point2 *p2, double lenv)
void UT2D_pt_traPtPtPar (Point2 *po, Point2 *p1, Point2 *p2, double d1)
void UT2D_pt_tra3ptlen (Point2 *po, Point2 *p1, Point2 *p2, Point2 *p3, double lenv)
void UT2D_pt_tra2pt2len (Point2 *po, Point2 *p1, Point2 *p2, double dx, double dy)
void UT2D_pt_tra2pt3len (Point2 *po, Point2 *p1, Point2 *p2, double dx, double dy, double lenv)
void UT2D_pt_traptvclen (Point2 *po, Point2 *pi, Vector2 *vc, double lenv)
void UT2D_pt_traptangrlen (Point2 *po, Point2 *pi, double ar, double lenv)
void UT2D_pt_tranor2ptlen (Point2 *po, Point2 *p1, Point2 *p2, double lenv)
void UT2D_pt_tranorptvclen (Point2 *po, Point2 *p1, Vector2 *v1, double lenv)
void UT2D_pt_traptvc2len (Point2 *po, Point2 *pi, Vector2 *vc, double dx, double dy)
void UT2D_pt_tracirlen (Point2 *pe, Point2 *pa, Point2 *pc, double rad, double clen)
void UT2D_pt_rotptangr (Point2 *p2, Point2 *pc, Point2 *p1, double ar)
int UT2D_pt_projpt2pt (Point2 *pp, double *len, Point2 *pt, Point2 *p1, Point2 *p2)
int UT2D_pt_projptptvc (Point2 *pp, Point2 *pt, Point2 *pl, Vector2 *vl)
int UT2D_pt_projptln (Point2 *pp, Point2 *pt, Line2 *ln)
int UT2D_pt_intptvcy (Point2 *pto, Point2 *ptl, Vector2 *vcl, double yVal)
int UT2D_pt_intlny (Point2 *pto, Point2 *lp1, Point2 *lp2, double yVal)
int UT2D_pt_intlnx (Point2 *pto, Point2 *lp1, Point2 *lp2, double xVal)
int UT2D_pt_int4pt (Point2 *ps, double *dp1, double *dp2, Point2 *p1, Point2 *p2, Point2 *p3, Point2 *p4)
int UT2D_pt_intlnln (Point2 *ip1, Line2 *ln1, int ln1Mode, Line2 *ln2, int ln2Mode)
int UT2D_pt_int2ln (Point2 *ip, Line2 *l1, Line2 *l2)
int UT2D_pt_int2pt2vc (Point2 *ip, Point2 *pt1, Vector2 *vc1, Point2 *pt2, Vector2 *vc2)
int UT2D_pt_int2vc2pt (Point2 *ip, Point2 *pt1, Vector2 *vc1, Point2 *pt2, Vector2 *vc2)
void UT2D_2pt_projptci (Point2 *ip1, Point2 *ip2, Point2 *pt, Point2 *cen, double rd1)
int UT2D_pt_projptci (Point2 *pp, Point2 *pt, Circ2 *ci1)
int UT2D_2pt_intciptvc (Point2 *ip1, Point2 *ip2, Point2 *cen1, double rd1, Point2 *pl, Vector2 *vl)
int UT2D_2pt_intcici (Point2 *ip1, Point2 *ip2, Point2 *cen1, double rd1, Point2 *cen2, double rd2)
int UT2D_2pt_intlnci (Point2 *ip1, Point2 *ip2, Line2 *ln, int lnMode, Circ2 *ci, int ciMode)
int UT2D_2pt_int2ci (Point2 *ip1, Point2 *ip2, Circ2 *ci1, int ci1Mode, Circ2 *ci2, int ci2Mode)
void UT2D_ln_4db (Line2 *ln2, double xs, double ys, double xe, double ye)
Line2 UT2D_ln_obj2 (ObjG2 *obj1)
int UT2D_comp2vc (Vector2 *v1, Vector2 *v2, double tol)
int UT2D_comp2vc_p (Vector2 *v1, Vector2 *v2, double tol)
int UT2D_sid_2vc (Vector *v1, Vector *v2)
int UT2D_sidPerp_2vc (Vector *v1, Vector *v2)
int UT2D_ckvc_in2vc (Vector *v1, Vector *v2, Vector *v3)
void UT2D_vc_angrlen (Vector2 *vc, double angr, double lenv)
void UT2D_vc_2pt3 (Vector2 *vc, Point *p1, Point *p2)
int UT2D_vc_2pt3_bp (Vector2 *vo, Point *p1, Point *p2, int bp)
void UT2D_vc_2ptlen (Vector2 *vc, Point2 *p1, Point2 *p2, double lenv)
void UT2D_vc_normalize (Vector2 *vn, Vector2 *vc)
void UT2D_vc_setLength (Vector2 *vco, Vector2 *vci, double new_len)
void UT2D_vc_mid2vc (Vector2 *vm, Vector2 *v1, Vector2 *v2)
void UT2D_vc_merge2vc (Vector2 *vm, Vector2 *v1, Vector2 *v2)
void UT2D_vc_rotangr (Vector2 *vco, Vector2 *vci, double alpha)
void UT2D_vc_travcm2 (Vector2 *vo, Mat_3x2 mata, Vector2 *vi)
double UT2D_len_ciSec (double hSec, double rCi)
double UT2D_angr_ciSec (double hc, double radc)
int UT2D_compPtOnAc (double w1, double wa, double we, int dreh)
Circ2 UT2D_ci_obj2 (ObjG2 *ci20)
int UT2D_ci_2vc2ptrd (Point2 pta[], Point2 *pt1, Vector2 *vc1, Point2 *pt2, Vector2 *vc2, double rad1)
int UT2D_ci_ciptvcrd (Point2 pta[], Point2 *ptc, double radc, int dir, Point2 *pt1, Vector2 *vc1, double rad1)
int UT2D_obj_obj3 (ObjGX *oo, ObjGX *oi, Memspc *memSeg)
ObjG2 UT2D_obj_pt3 (Point *pt1)
ObjG2 UT2D_obj_ln3 (Line *ln1)
ObjG2 UT2D_obj_ci2 (Circ2 *ci1)
ObjG2 UT2D_obj_ci3 (Circ *ci1)
ObjG2 UT2D_obj_cv3 (Curv *cv1)
Point2 UT2D_pt_obj2 (ObjG2 *obj1)
int UT2D_void_obj2 (void *memObj, unsigned long *oSiz, ObjG2 *og2)
int UT2D_cv3_linear (int *pNr, Point *pTab, double tol)
int UT2D_cv_inv (int ptNr, Point2 *pta)
int UT2D_srar_polc (double *aro, int ptNr, Point2 *pa)
int UT2D_srar_inpt3 (double *aro, int ptNr, int *ipa, Point *pa)
int UT2D_npt_ci (Point2 *pa, int pNr, Circ2 *ci1)
void UT2D_cv_ci360 (Point2 *cv, int ptNr, double rd, Point2 *ptCen)
int UT2D_cv_ln (Point2 *cv, int ptAnz, Point2 *p1, Point2 *p2)
int UT2D_cv_ci_ (Point2 *pa, int *ptNr, Circ2 *ci1, int ptMax, double tol)
int UT2D_cv_ci (Point2 cv[], int *ptanz, Point2 *pa, Point2 *pe, Point2 *pm, int idiv)
double UT2D_lenB_2pt (Point2 *p1, Point2 *p2)
int UT2D_minLenB_4pt (double *dp, Point2 *p1a, Point2 *p1e, Point2 *p2a, Point2 *p2e)
int UT2D_pt_ck_int4pt (Point2 *pi1, Point2 *pi2, Point2 *pi3, Point2 *pi4)
int UT2D_i4pt_npt (int *ixMin, int *ixMax, int *iyMin, int *iyMax, int pNr, Point2 *ptab)
double UT2D_ar_3pt (Point2 *p1, Point2 *p2, Point2 *p3)
int UT2D_pt_ck_onLine (Point2 *po, Point2 *p1, Point2 *p2, Point2 *p3)
int UT2D_pt_ck_inLine (Point2 *p1, Point2 *p2, Point2 *p3, double tol)
int UT2D_pt_ck_inplg (Point2 *pTab, int pNr, Point2 *ptx)
int UT2D_pt_ck_linear (int np, Point2 *ptab, double tol)
int UT2D_pt_ck_inpt2vc (Point2 *px, Point2 *po, Vector2 *v1, Vector2 *v2)
int UT2D_pt_ck_inAc (Point2 *pt, Circ2 *ci)
int UT2D_pt_ck_inCv3 (Point *ptx, int pNr, Point *pTab)
int UT2D_pt_cknear_npt (Point2 *p0, Point2 *ptTab, int ptNr)
int UT2D_ci_ptvcci (Point2 *pc2, Point2 *pi, double *r2, Point2 *pt, Vector2 *vct, Point2 *pc1, double r1)
int UT2D_ci_ptvcptvc (Point2 *pc, Point2 *p2, double *crad, Point2 *p1, Vector2 *v1, Point2 *pt, Vector2 *vt)
int UT2D_vc_cipt (Vector2 *vc1, Point2 *pc, Point2 *pt, int cdir)
int UT2D_ci_ci3 (Circ2 *ci2, Circ *ci3)
int UT2D_ci_ptrd (Circ2 *ci, Point2 *ptc, double rdc)
int UT2D_ci_pt2vcrd (Circ2 *ci2, Point2 *pc, Vector2 *vc1, Vector2 *vc2, double *rdc)
int UT2D_ci_ptvcpt (Point2 *pc, double *radc, Point2 *ps, Vector2 *vcs, Point2 *pe)
int UT2D_m2_invtravcm2 (Mat_3x2 im1, Mat_3x2 m1)
void UT2D_m2_load (Mat_3x2 ma, Vector2 *vc1, Point2 *ori)
void UT2D_m2_loadtravcm2 (Mat_3x2 ma, Vector2 *vx, Vector2 *vy, Vector2 *vt)
void UT2D_m2_init_rot (Mat_3x2 ma, double angle)
void UT2D_pt_traptm2 (Point2 *p2, Mat_3x2 mata, Point2 *p1)
int UT2D_lncoe_ln (double *k, double *d, Line2 *ln)
int UT2D_ln_pts_dmax (Line2 *ln, int np, Point2 *ptab, double tol)
int UT2D_2parvc_3vc (double *dx, double *dy, Vector2 *v1, Vector2 *v2, Vector2 *v3)
int UT2D_ptNr_ci (double rdc, double ao, double tol)
void UT2D_pt_traptm3 (Point2 *p2, Mat_4x3 mata, Point2 *p1)


Function Documentation

int UT2D_ptvc_ck_int2pt ( int  mode,
Point2 p1s,
Vector2 v1,
Point2 p2s,
Point2 p2e 
)

    UT2D_ptvc_ck_int2pt       check if Line|Ray Pt-Vec intersects Line Pt-Pt
    Line = both sides limited; Ray = one side unlimited.
   
    Input:
      mode = 0  p1s-v1: both sides unlimited; p2s-p2e: both sides limited.
      mode = 1  p1s-v1: one side unlimited; p2s-p2e: both sides limited.
   
    Returncodes:
    -1 = no intersection between unlimited Line p1s-v1 and segment p2s-p2e.
     0 = OK; lines intersect.
     1 = p1s-v1 goes tru p2s
     2 = p1s-v1 goes tru p2e
     3 = p1s-v1 and p2s-p2e are parallel; no intersection-checks yet !
     4 = p1s lies exact on p2s-p2e.     (ONLY if mode=1)
     5 = p1s and p2s are equal          (ONLY if mode=1)
     6 = p1s and p2e are equal          (ONLY if mode=1)

int UT1D_ndb_npt_bp ( double *  da,
Point pa,
int  pNr,
int  bp 
)

UT1D_ndb_npt_bp copy the backplane-part of a pointTable

int UT2D_angr_set ( double *  angr  ) 

UT2D_angr_set change to val >= 0 <= RAD_360

int UT2D_2angr_set ( double *  ang1,
double *  ang2,
int  irot 
)

    UT2D_2angr_set     change consecutive values from -RAD_360 to RAD_360
    if irot == 1 (CCW) ang2 > ang1
    if irot == -1 (CW) ang2 < ang1

double UT2D_angr_2angr ( double  ang1,
double  ang2,
int  irot 
)

    UT2D_angr_2angr                   angle between 2 angles
    irot =  1   CCW
    irot = -1   CW

int UT2D_comp2angd_p ( double  d1,
double  d2,
double  tol 
)

    UT2D_comp2angd_p      compare 2 angles (deg) for parallel
    Retcode 0 = no, angles not parallel
    Retcode 1 = yes, angles are parallel

int UT2D_solvtriri_a ( double *  a,
double  b,
double  c 
)

    UT2D_solvtriri_a         right-angled tri: a from sides b and c
   
                  C              Der rechte Winkel liegt im Punkt C.
                / . \
              /       \
            b           a
          /               \
        A -------c-------- B      c = hypotenuse
   
   
     a*a + b*b = c*c
   
     a = sqrt (c*c - b*b)

int UT2D_solvtriri_c_abfc ( double *  c,
double  a,
double  x 
)

    UT2D_solvtriri_c_abfc          scalene tri: c from a and x; b=x*c;
    Allgemeines Dreieck. a ist gegeben, b = x * c; c ist gesucht.
    Used for Rat.B-spl.Crv --> Circ (UT3D_ci_rbspl3)
    Input:
        a = length of side a
        x = factor;   b = c * x;
    Output:
        c = length of side c
   
   
          +
          |\
          | \
         a|  \c
          |   \
          +----+
            b
    b=x*c;
    a*a + x*x*c*c = c*c
    c=sqrt(a*a/((x*x)-1)

int UT2D_solvtriri_ac ( double *  q,
double *  hc,
double  b,
double  c 
)

    UT2D_solvtriri_ac         right-angled tri: q and hc from sides b and c.
    
                   C              Der rechte Winkel liegt im Punkt C.
                 / | \
               /   |   \
             b    hc     a
           /       |       \
         A -------c-------- B
               q      p
    
    c = hypotenuse (baseline),
    b = side left,
    a = side right,
    hc is a normal to c. This normal parts c into
    q (lying under b) and
    p (lying under a).
    
    Returns:
    q  - the length of b projected to c;
    hc - the length of the normal standing on c

int UT2D_solvtri_abc ( double *  q,
double *  hc,
double  a,
double  b,
double  c 
)

    UT2D_solvtri_abc          scalene tri: q and hc from sides a, b and c.
    
    
                   C               Allgemeines Dreieck. Kein rechter Winkel.
                 / | \
               /   |   \
             b    hc     a
           /       |       \
         A -------c-------- B
               q      p
    
    
    compute triangle.
    
    c is the baseline;
    b = side left,
    a = side right, (liegt gegenueber Punkt A !)
    hc is a normal to c. This normal parts c into
    q (lying under b) and
    p (lying under a).
    
    
    Input: the length of the sides a, b, c.
    
    Output:
      q  - the length of b projected to c; (with direction - can be negativ !)
      hc - the length of the normal standing on c
    
    Retcodes:
      0 - Ok.
     -1 - error; c = 0.;
     -2 - error; b > a + c;
     -3 - error; a > b + c;

int UT2D_sidPerp_3pt ( Point2 p1,
Point2 p2,
Point2 p3 
)

    UT2D_sidPerp_3pt        check if p3 is in, before or behind perp-line tru p2
    Ist p3 vor oder hinter der Linie, die durch p2 geht u.normal auf p1-p2 steht
    RC  -1 p3 liegt vor Ebene p1-p2 (vis-a-vis)
    RC   0 p3 liegt genau in der Ebene
    RC   1 liegt hinter Ebene p1-p2 (in der Naehe von p2)
   
                p3     |
                x      |
                .      |
                . -1   0    +1
                .      |
        x--------------x
       p1              p2
   
    see also UT3D_acos_2vc

double UT2D_angr_angd ( double  angd  ) 

UT2D_angr_angd angle (radians) = angle (degrees)

double UT2D_angd_angr ( double  angr  ) 

UT2D_angd_angr angle (degrees) = angle (radians)

double UT2D_angd_invert ( double *  andi  ) 

UT2D_angd_invert ang(deg.) invert (change direction)

double UT2D_angr_triri_ab ( double  b,
double  a 
)

    UT2D_angr_triri_ab        right-angled tri: angle alfa from sides a and b.
    
    c = hypotenuse (baseline),
    b = side left,
    a = side right,
    the sides b - a include the right-angle.
    
    Returns the angle alfa (in rad; which is included by the sides b and c).

double UT2D_angr_ptpt ( Point2 pt1,
Point2 pt2 
)

UT2D_angr_ptpt angle (radians) = pt > pt

double UT2D_angr_vc ( Vector2 vc  ) 

UT2D_angr_vc angle (radians) = vector (0-360)

double UT2D_angr_2ln ( Line2 ln1,
Line2 ln2 
)

UT2D_angr_2ln angle (rad.) between 2 Lines

double UT2D_angr_2vc ( Vector2 vc1i,
Vector2 vc2i 
)

    UT2D_angr_2vc             angle (rad.) between 2 Vectors
    Die Vektoren muessen CCW liegen; vc1 entspricht der X-Achse; vc2 CCW davon.

double UT2D_angr_3ptdr ( Point2 pa,
Point2 pe,
Point2 pc,
int  dreh 
)

DO NOT USE; use UT2D_angr_ci

double UT2D_len_2pt ( Point2 p1,
Point2 p2 
)

UT2D_len_2pt distance pt - pt

double UT2D_len_ptln ( Point2 pt,
Point2 pa,
Point2 pe 
)

    UT2D_len_ptln      get (signed)  minDist from pt to Line pa-pe

int UT2D_3len_ptln ( double *  d1,
double *  dx,
double *  dy,
Point2 pt,
Point2 pa,
Point2 pe 
)

    ck minimalAbst von pt auf Line pa,pe
    feststellen, ob der Normalpunkt auf oder ausserhalb Line ist
      (Normalpunkt = Projektion von pt auf Line pa-pe)
    Auf Line: den Abstand pt-NormalPt liefern (mit Vorzeichen)
    nicht auf Line: den Abstand zum naeheren Endpunkt liefern
    d1: Normalabstand od MindestAbstand
    dx: LaengsAbstand (der Abstand des NormalPunktes von pa)
    dy: der Normalabstand von pt zur Line pa-pe;
        Vorzeichen positiv: pt links von pa; negativ: rechts von pa.
   
    RetCod:
     -1 = vor pa;         dy ist nicht gueltig !
      0   zwischen pa-pe; dx,dy sind gueltig
      1   ausserhalb pe;  dy ist nicht gueltig !

int UT2D_slenq_ptptvc ( double *  qlen,
Point2 pa,
Point2 pb,
Point2 pc 
)

    UT2D_slenq_ptptvc         signed quadr.Distance pt-pt in Richtung vec
    pa - pb gives a line, pc is projected onto this line.
   
                 c
                 |
                 |
           len   |
        a--------+------b
                 e
   
    see UT2D_sidPerp_3pt

double UT2D_slen_nor3pt ( Point2 p1,
Point2 p2,
Point2 p3 
)

    UT2D_slen_nor3pt          signed length of normal point - line
    gibt den Abstand den p2 auf die Linie p1 - p3 hat mit Vorzeichen.

double UT2D_slen_norvc2pt ( Vector2 v1,
Point2 p1,
Point2 p2 
)

    UT2D_acos_vc2pt           signed length of normal vector - vector
    For true length v1 must be normalized !
    see UT2D_acos_2vc
   
                       . p2
                     .   X
                   .     .
                 .       .
              v2         .   sk = Normalabst von vec p1-p2 auf vec p1-v1
             .           .
           .             .
         .               .
       X-----------------.-------
       p1            v1

int UT2D_nlenq_3pt ( double *  qlen,
Point2 pa,
Point2 pb,
Point2 pc 
)

    UT2D_nlenq_3pt                 give quadr.Distance from point to line
    pa - pb gives a line, pc is projected onto this line.
   
               c
               |
            len|
               |
        a------+--------b
               e

int UT2D_parLn_pt2pt ( double *  d1,
Point2 p1,
Point2 p2,
Point2 px 
)

get parameter (0-1) of point px along line p1-p2

see also UTP_param_p0p1px

void UT2D_2len_ptvc ( double *  dx,
double *  dy,
Point2 pt,
Point2 pb,
Vector2 vc 
)

    UT2D_2len_ptvc            dx,dy = dist pt - pb along / normal to vector vc
    
    Input:
      pb,vc  - define the axissystem (origin and x-axis)
      pt     - point in this axissystem
    
    Output:
      dx     - gives the distance along vc from pb to pt (can be negativ !)
      dy     - gives the distance normal to vc from pb to pt (can be negativ !)

double UT2D_angr_ci ( Point2 pa,
Point2 pe,
Point2 pc,
double  rad_in 
)

    UT2D_angr_ci              openingAngle of circle (pa,pe,pc,rad/dreh)
    
    Der Winkel ist bei CW-Kreisen immer negativ (-360 - 0 - 360).
    
    
    Achtung: rad gibt auch die Drehrichtung !
      CCW = rad > 0 ;
      CW  = rad < 0 ;

double UT2D_angr_perpangr ( double *  ai  ) 

UT2D_angr_perpangr angle + 90 degree (perp. to angle)

double UT2D_len_cir ( double *  angOpe,
Point2 pa,
Point2 pe,
Point2 pc,
double  rad_in 
)

    UT2D_len_cir              length circular arc (pa,pe,pc,rad/dreh)
    
    Laenge immer positiv (angOpe nicht !)
    
    Liefert auch den Oeffnungswinkel angOpe.
    
    Achtung: rad gibt auch die Drehrichtung !
      CCW = rad > 0 ;
      CW  = rad < 0 ;

double UT2D_len_ptlnX ( Point2 pt,
Point2 pl,
Vector2 vl 
)

    UT2D_len_ptlnX          Laengsabst.(m.Vorz.) eines Punktes auf Linie (pl-vl)
    
    Achtung: liefert den Abstand von pl nach pt !
      (den X-Wert der Normalen von pt auf pl/vl).
    Vorzeichen:  wenn pl in 0,0 und vl als 1,0 angenommen wird, entspricht der
     Abstand dem X-Wert; Vorzeichen also Positiv bei pt= rechts von pl-vl.

double UT2D_len_ptlnY ( Point2 pt,
Point2 pl,
Vector2 vl 
)

    UT2D_len_ptlnY           Normalabst.(m.Vorz.) eines Punktes von Linie (pl-vl)
    
    vl muss  nicht normalisiert sein.
    
    Vorzeichen:  wenn pl in 0,0 und vl als 1,0 angenommen wird, entspricht der
     Abstand dem Y-Wert; Vorzeichen also Positiv bei pt= oberhalb von pl-vl.

int UT2D_sid_3pt ( Point2 pt,
Point2 p1,
Point2 p2 
)

    UT2D_sid_3pt               compare if pt is on, above or below line (p1-p2)
     0   pt is on vector vl
     1   pt is above vector vl (left side)
    -1   pt is below vector vl (right side)

int UT2D_sid_ptvc ( Point2 pt,
Point2 pl,
Vector2 vl 
)

    UT2D_sid_ptvc             compare if pt is on, above or below line (pl+vl)
   
    was UT2D_dir_ptvc
    
    retcode:
      0   pt is on vector vl
      1   pt is above vector vl (left side)
     -1   pt is below vector vl (right side)

int UT2D_sidPerp_ptvc ( Point2 pt,
Point2 pl,
Vector2 vl 
)

    UT2D_sidPerp_ptvc        compare if pt is right/on/left of a normal to pt+vc
    
    retcode:
      0   pt is on a normal to vector vl
      1   pt is before pl (to the right side of a normal to vector vl)
     -1   pt is behind pl (to the left side of a normal to vector vl)

int UT2D_comp4pt ( Point2 p1a,
Point2 p1e,
Point2 p2a,
Point2 p2e,
double  tol 
)

    UT2D_comp4pt              compare 4 2D-points
    Ob 2 der 4 Punkte zusammenpassen
      (zum Test ob 2 Lines einen gemeinsamen Punkt haben).
    Retcode 0 = Abstand aller Punkte > tol
            1 = Abstand (p1e - p2a) < tol
            2 = Abstand (p1a - p2a) < tol  (Obj 1 verkehrt)
            3 = Abstand (p1e - p2e) < tol  (Obj 2 verkehrt)
            4 = Abstand (p1a - p2e) < tol  (Obj 1 und 2 verkehrt)

void UT2D_pt_tra2ptlen ( Point2 po,
Point2 p1,
Point2 p2,
double  lenv 
)

UT2D_pt_tra2ptlen transl. point p1 into dir p1 -> p2 dist. lenv

void UT2D_pt_traPtPtPar ( Point2 po,
Point2 p1,
Point2 p2,
double  d1 
)

    UT2D_pt_traPtPtPar      transl. pt with parameter along p1-p2
   
    see UT3D_pt_evpar2pt UT3D_vc_multvc UT2D_pt_traptvc

void UT2D_pt_tra3ptlen ( Point2 po,
Point2 p1,
Point2 p2,
Point2 p3,
double  lenv 
)

UT2D_pt_tra3ptlen transl. point p1 into dir p2 -> p3 dist. lenv

void UT2D_pt_tra2pt2len ( Point2 po,
Point2 p1,
Point2 p2,
double  dx,
double  dy 
)

UT2D_pt_tra2pt2len transl. point into dir p1 -> p2 dist. dx and normal dy

void UT2D_pt_tra2pt3len ( Point2 po,
Point2 p1,
Point2 p2,
double  dx,
double  dy,
double  lenv 
)

UT2D_pt_tra2pt3len move p1; Baseline p1-p2; Dir dx/dy; length lenv.

void UT2D_pt_traptvclen ( Point2 po,
Point2 pi,
Vector2 vc,
double  lenv 
)

UT2D_pt_traptvclen move pi along vc length lenv

void UT2D_pt_traptangrlen ( Point2 po,
Point2 pi,
double  ar,
double  lenv 
)

UT2D_pt_traptangrlen move point; direction from angle, distance=lenv

void UT2D_pt_tranor2ptlen ( Point2 po,
Point2 p1,
Point2 p2,
double  lenv 
)

    UT2D_pt_tranor2ptlen      transl. point normal to p1 - p2 dist. lenv
      Center is p1; p1-p2 gives the baseline

void UT2D_pt_tranorptvclen ( Point2 po,
Point2 p1,
Vector2 v1,
double  lenv 
)

    UT2D_pt_tranorptvclen     transl. point normal to vec dist. lenv
      Center is p1; p1-v1 gives the baseline

void UT2D_pt_traptvc2len ( Point2 po,
Point2 pi,
Vector2 vc,
double  dx,
double  dy 
)

    UT2D_pt_traptvc2len       transl. point into dir vc; dist. dx and normal dy
    Move point into direction vc with distance dx and normal to vc -
    with distance dy.

void UT2D_pt_tracirlen ( Point2 pe,
Point2 pa,
Point2 pc,
double  rad,
double  clen 
)

    UT2D_pt_tracirlen         transl. point circular length
   
    rad  = Radius; Pos.Val = CCW; neg.Val =CW.
    clen = arcLenght

void UT2D_pt_rotptangr ( Point2 p2,
Point2 pc,
Point2 p1,
double  ar 
)

    UT2D_pt_rotptangr         rotate a point around centerpoint
    
    p2 darf ident mit p1 sein.

int UT2D_pt_projpt2pt ( Point2 pp,
double *  len,
Point2 pt,
Point2 p1,
Point2 p2 
)

    UT2D_pt_projpt2pt                pp = project point pt to lineSegment p1-p2
   
    p1-p2 is a line, pt is projected onto this line.
    len ist the len pt-pp  (if not NULL)
   
     -1   1       0         2   -2         retcod
          |       pt        |
                  |
               len|
                  |
          p1------+--------p2
                  pp
   
    Input:
      len    NULL or address
    Output:
      pp     pr projected to p1-p2
      len    distance pt-pp if not NULL on input
      retcod 0=OK, pp is on line, between p1-p2
             1 OK; pp = p1
             2 OK; pp = p2
            -1 outside; pt is before line
            -2 outside; pt if after line
            -3 Input-Error; p1==p2
   
    see also UT3D_pt_ck_ptvc UT3D_pt_ck_onLine UT3D_nlen_2ptvc UT3D_pt_projptptvc
      UT3D_pt_projptln

int UT2D_pt_projptptvc ( Point2 pp,
Point2 pt,
Point2 pl,
Vector2 vl 
)

    UT2D_pt_projptptvc        point = project point to line (pt+vc)
    Project a point onto a line given by point and vector.
    pl - vl gives a line, pt is projected onto this line.
   
    IN:
      Point2 *pt   ... point to project on line pl-vl
      Point2 *pl   ... point on line
      Vector2 *vl  ... vector of line
    OUT:
      Point2 *pp   ... normal projection of pt onto line
    Returncodes:
      0 = OK
      1 = point is on line

int UT2D_pt_projptln ( Point2 pp,
Point2 pt,
Line2 ln 
)

UT2D_pt_projptln point = project point to line

int UT2D_pt_intptvcy ( Point2 pto,
Point2 ptl,
Vector2 vcl,
double  yVal 
)

    UT2D_pt_intptvcy            intersection line (pt-vc) - horizontal line
    Schnittpunkt eines Linesegmentes ln1 mit einer unendlich langen,
    horiz. Geraden mit Y=yVal errechnen.
    Retcod= 0: Schnittpunkt in pto
    Retcod= 1: Linie vertical; beliebig viele Schnittpunkte

int UT2D_pt_intlny ( Point2 pto,
Point2 lp1,
Point2 lp2,
double  yVal 
)

    UT2D_pt_intlny            intersection linesegment - horizontal line
    Schnittpunkt eines Linesegmentes ln1 mit einer unendlich langen,
    horizontalen Geraden mit Y=yVal errechnen.
    Retcod= 0: Schnittpunkt in pto
    Retcod=-1: kein Schnittpunkt
    Retcod= 1: Linie horizontal; beliebig viele Schnittpunkte

int UT2D_pt_intlnx ( Point2 pto,
Point2 lp1,
Point2 lp2,
double  xVal 
)

    UT2D_pt_intlnx            intersection linesegment - vertical line
    Schnittpunkt eines Linesegmentes ln1 mit einer unendlich langen,
    vertical Geraden mit X=xVal errechnen.
    Retcod= 0: Schnittpunkt in pto
    Retcod=-1: kein Schnittpunkt
    Retcod= 1: Linie vertical; beliebig viele Schnittpunkte

int UT2D_pt_int4pt ( Point2 ps,
double *  dp1,
double *  dp2,
Point2 p1,
Point2 p2,
Point2 p3,
Point2 p4 
)

    intersection of 2 limited lines
    Info, ob Schnittpunkt ident mit p1 oder p2 (p3,p4 werden nicht getestet)
    Info, ob p1-p2 und p3-p4 uebereinanderliegen (ueberlappen)
    RC = -1   NO; Point outside Line p1-p2
    RC =  0   Yes; intersect; ps=p1; dp1=0;
    RC =  1   Yes; intersect; ps between p1-p2;
              dp1 ist der Abstandswert (0-1) des Schnittpunktes entlang p1-p2
    RC =  2   Yes; intersect; ps=p2; dp1=1;
    RC =  3   Lines parallel - Endpoints touch (not overlap). ps, dp1 unused.
    RC =  4   Lines parallel and overlap; ps, dp1 unused.

int UT2D_pt_intlnln ( Point2 ip1,
Line2 ln1,
int  ln1Mode,
Line2 ln2,
int  ln2Mode 
)

    UT2D_pt_intlnln         intersect Line x Line; both limited or unlimited
    lnxMode 0=limited Line, 1=unlimited Line.
    Retcod 0    OK
          -1    no intersectionpoint
    see also UT2D_pt_int2ln UT2D_pt_int4pt

int UT2D_pt_int2ln ( Point2 ip,
Line2 l1,
Line2 l2 
)

    UT2D_pt_int2ln            point = intersection of 2 lines
    
    Returncodes:
     0 = Lines parallel or zero-length
     1 = OK.

int UT2D_pt_int2pt2vc ( Point2 ip,
Point2 pt1,
Vector2 vc1,
Point2 pt2,
Vector2 vc2 
)

    UT2D_pt_int2pt2vc         point = intersection of 2 vectors + 2 Points
    intersection of 2 unlimited lines
   
    Returncodes:
     0 = Lines parallel or zero-length
     1 = OK; ip = intersectionPoint;
   
    see also UT2D_pt_int2vc2pt

int UT2D_pt_int2vc2pt ( Point2 ip,
Point2 pt1,
Vector2 vc1,
Point2 pt2,
Vector2 vc2 
)

    UT2D_pt_int2vc2pt         point = intersection of 2 vectors + 2 Points
   
    Es wird auch getestet, ob der Schnittpunkt ip sich auf oder ausserhalb des
      vc1 / vc2 befindet.
   
    Returncodes:
     0 = Lines parallel or zero-length
     1 = OK; Schnittpunkt befindet sich auf vc1 und auf vc2.
     2 = OK; Schnittpunkt befindet sich nicht auf vc1 (vc2 wird nicht getestet)
     3 = OK; Schnittpunkt befindet sich auf vc1, nicht auf vc2.

void UT2D_2pt_projptci ( Point2 ip1,
Point2 ip2,
Point2 pt,
Point2 cen,
double  rd1 
)

    UT2D_2pt_projptci         project point to circle
    
    ip1 ist the nearer solution,
    ip2 is farer away from cen

int UT2D_pt_projptci ( Point2 pp,
Point2 pt,
Circ2 ci1 
)

    UT2D_pt_projptci         project point to Arc (segment of circle)
    2 solutions: der nearest point is selected.
    RetCod: 0 = yes, pp is in Arcsegment;
           -1 = no; none of the 2 projectionpoints is on the ArcSegment.

int UT2D_2pt_intciptvc ( Point2 ip1,
Point2 ip2,
Point2 cen1,
double  rd1,
Point2 pl,
Vector2 vl 
)

    UT2D_2pt_intciptvc        intersect Circle - Line (pt+vc)
    
    ip1 immer jener Punkt, 
    
    Return code:
      0 ... normal intersection (2 Ergebnispunkte)
      1 ... circle touches line
      -1 .. no intersection

int UT2D_2pt_intcici ( Point2 ip1,
Point2 ip2,
Point2 cen1,
double  rd1,
Point2 cen2,
double  rd2 
)

    UT2D_2pt_intcici                intersect 2 Circles
      
    Return code:
      0 ... normal intersection
      1 ... circles touch each other
      -1 .. circles do not intersect

int UT2D_2pt_intlnci ( Point2 ip1,
Point2 ip2,
Line2 ln,
int  lnMode,
Circ2 ci,
int  ciMode 
)

    UT2D_2pt_intlnci         intersect Line x Circ; both limited or unlimited 
    lnMode 0=limited Line, 1=unlimited Line.
    ciMode 0=limited Circ, 1=unlimited Circ.
    Retcod 1/2  number of intersectionpoints
          -1    no intersectionpoint

int UT2D_2pt_int2ci ( Point2 ip1,
Point2 ip2,
Circ2 ci1,
int  ci1Mode,
Circ2 ci2,
int  ci2Mode 
)

    UT2D_2pt_int2ci         intersect Circ x Circ; both limited or unlimited
    ciXMode 0=limited Circ, 1=unlimited Circ.
    Retcod 1/2  number of intersectionpoints
          -1    no intersectionpoint

void UT2D_ln_4db ( Line2 ln2,
double  xs,
double  ys,
double  xe,
double  ye 
)

UT2D_ln_4db 2D-Line from 4 doubles

Line2 UT2D_ln_obj2 ( ObjG2 obj1  ) 

    UT2D_ln_obj2              2D-Obj > 2D-Line
    DO NOT USE

int UT2D_comp2vc ( Vector2 v1,
Vector2 v2,
double  tol 
)

    UT2D_comp2vc              compare 2 vectors for parallel and antiparallel
    Vectors must not be normalized.
    tol applies to length 1
    Returns 1 if parallel=yes, else 0.
    if(UT2D_comp2vc(&vc1, &vc2, UT_TOL_pt)) printf("  parallel=yes");

int UT2D_comp2vc_p ( Vector2 v1,
Vector2 v2,
double  tol 
)

    UT2D_comp2vc_p            compare 2 vectors for parallel
    Compare directions; lenght is normalized (tol applies to length 1)
    Returns 1 wenn parallel, else 0.

int UT2D_sid_2vc ( Vector v1,
Vector v2 
)

    UT3D_cklr_2vc        check vc for left (CCW, above) or right (CW, below)
    Vektoren muessen nicht normiert sein !
    RC  -1   v2 is CW from v1   (neg. angle)
    RC   0   v1-v2 are parallel
    RC   1   v2 is CCW from v1  (pos. angle)
    
    see also UT2D_sidPerp_2vc

int UT2D_sidPerp_2vc ( Vector v1,
Vector v2 
)

    UT2D_sidPerp_2vc        check vecs for inFront, perp.(normal), or behind
    Ist v2 vor oder hinter einem Normalvektor auf v1 durch den Startpunkt von v1.
    sind Vektoren eher parallel oder anpiparallel ..
    Vektoren muessen nicht normiert sein !
    RC  -1 vecs point into opposit direction (angle > 90 deg.)
    RC   0 vecs are perpendicular  (angle = 90 deg)
    RC   1 vecs point into same direction (angle < 90 deg)
    
    see also UT2D_sid_2vc UT3D_acos_2vc

int UT2D_ckvc_in2vc ( Vector v1,
Vector v2,
Vector v3 
)

    UT2D_ckvc_in2vc         check if v2 is between v1 and v3
    the opening-angle of v1-v3 is less than 180 deg.
    
    RetCod:
    0 = no; v2 is NOT between v1 and v3
    1 = yes; v2 = between v1 and v3

void UT2D_vc_angrlen ( Vector2 vc,
double  angr,
double  lenv 
)

UT2D_vc_angrlen 2DVector = angle (radians) + Length

void UT2D_vc_2pt3 ( Vector2 vc,
Point p1,
Point p2 
)

UT2D_vc_2pt3 2D-Vector = 3D-Point -> 3D-Point

int UT2D_vc_2pt3_bp ( Vector2 vo,
Point p1,
Point p2,
int  bp 
)

2D-Vector = (3D-Point -> 3D-Point) on Backplane

void UT2D_vc_2ptlen ( Vector2 vc,
Point2 p1,
Point2 p2,
double  lenv 
)

UT2D_vc_2ptlen 2D-Vector = 2D-Point -> 2D-Point, set Length

void UT2D_vc_normalize ( Vector2 vn,
Vector2 vc 
)

UT2D_vc_normalize change to length 1

void UT2D_vc_setLength ( Vector2 vco,
Vector2 vci,
double  new_len 
)

    UT2D_vc_setLength                change 2D-Vectorlength
    vco und vci dürfen ident sein.
    use UT2D_vc_multvc with vectors of length=1

void UT2D_vc_mid2vc ( Vector2 vm,
Vector2 v1,
Vector2 v2 
)

    UT2D_vc_mid2vc            vector = midVector between 2 vectors

void UT2D_vc_merge2vc ( Vector2 vm,
Vector2 v1,
Vector2 v2 
)

UT2D_vc_merge2vc merge 2 vectors vNew = (v1 + v2) / 2

void UT2D_vc_rotangr ( Vector2 vco,
Vector2 vci,
double  alpha 
)

    UT2D_vc_rotangr                  rotate a 2D_vector
    
    (vco and vci can be the same adress)

void UT2D_vc_travcm2 ( Vector2 vo,
Mat_3x2  mata,
Vector2 vi 
)

    UT2D_vc_travcm2          2D-vector transformation (3x2-matrix)
    
    UT2D_vc_travcm2          Author: Thomas Backmeister         9.4.2003
    
    Transformation of a 2D-vector with a 3x2-matrix.
    
    IN:
      Mat_3x2 mata ... transformation matrix
      Vector2 *vi  ... 2D-vector
    OUT:
      Vector2 *vo  ... transformed 2D-vector

double UT2D_len_ciSec ( double  hSec,
double  rCi 
)

    UT2D_len_ciSec          cmp length of secant from radius + height of secant.
    
                                        Gegeben:
             _  - + -  _                  x = hSec = Hoehe der sekante
           ^      |x     ^                c = rCi  = radius Kreis
         /        |        \
        +---a-----+---a-----+           Gesucht:
                  |       /               a = lSec = halbe Laenge der Sekante
                 b|     /
                  |   /c                b = c - x
                  | /                   a*a + b*b = c*c
                  +                     a = sqrt (c*c - b*b)
                 CirCen

double UT2D_angr_ciSec ( double  hc,
double  radc 
)

    UT2D_angr_ciSec           opening angle of Secant of Circ
                              for length of secant see UT2D_len_ciSec

int UT2D_compPtOnAc ( double  w1,
double  wa,
double  we,
int  dreh 
)

     Testen, ob sich ein Punkt auf einem Arc befindet. Die Winkel
     sind Input (ev. aus UT2D_angr_ptpt).
     Out als RetCod: YES oder NO.

Circ2 UT2D_ci_obj2 ( ObjG2 ci20  ) 

UT2D_ci_obj2 2D-Circ = 2D-ObjG

int UT2D_ci_2vc2ptrd ( Point2  pta[],
Point2 pt1,
Vector2 vc1,
Point2 pt2,
Vector2 vc2,
double  rad1 
)

    UT2D_ci_2vc2ptrd          2D-Circ; verrundet 2 Lines; 4 Lösungen
    
    Achtung: es werden nur die Kreismittelpunkte (4) retourniert !
    
    pta[0] ist zwischen vc1 und vc2 (CCW, vom Schnittpunkt aus).
    pta[1] ist genau gegenüber pta[0]. 
    pta[2] ist normal auf pta[0] (also um 90 Grad CCW weiter als pta[0])
    pta[3] ist genau gegenüber pta[2]
    
    Retcode: 0=Error (Lines parallel);

int UT2D_ci_ciptvcrd ( Point2  pta[],
Point2 ptc,
double  radc,
int  dir,
Point2 pt1,
Vector2 vc1,
double  rad1 
)

    UT2D_ci_ciptvcrd          2D-Circ; verrundet Circ/Line; 4 Lösungen
    
    Es werden nur die neuen Kreismittelpunkte (4 od. 2 od. 0) retourniert !
    dir: bestimmt ob die 4 inneren oder die 4 ausserern Mittelpunkte
      geliefert werden!   (sonst wären es 8 Lösungspunkte)
    dir = 0:  alle Lösungen sind INNERHALB Cir1
    dir = 1:  alle Lösungen sind AUSSERHALB Cir1
    
    pta[0] ist zwischen der Linie pt1/vc1 und dem Mittelpkt ptc,
           vom ptc weg in Richtung des vc1.
    pta[1] ist zwischen der Linie pt1/vc1 und dem Mittelpkt ptc,
           aber hinter ptc (bezügl Richtung vc1)
    pta[2] ist gegenüber dem Mittelpunkt ptc bezügl. der Linie pt1/vc1,
           vom ptc weg in Richtung des vc1 (wie Lösung [0])
    pta[3] ist gegenüber dem Mittelpunkt ptc bezügl. der Linie pt1/vc1,
           aber hinter ptc (bezügl Richtung vc1, wie Lösung [1])
    
    Retcode: 0=Error (Lines parallel);

int UT2D_obj_obj3 ( ObjGX oo,
ObjGX oi,
Memspc memSeg 
)

    UT2D_obj_obj3             change 3D-Obj > 2D-Obj (remove Z-val)
    3D-Objekt in 2D-Objekte umwandeln (remove Z-Wert)

ObjG2 UT2D_obj_pt3 ( Point pt1  ) 

UT2D_obj_pt3 change 3D-Point > 2D-Obj

ObjG2 UT2D_obj_ln3 ( Line ln1  ) 

    UT2D_obj_ln3              change 3D-Line > 2D-Obj
    DO NOT USE

ObjG2 UT2D_obj_ci2 ( Circ2 ci1  ) 

    UT2D_obj_ci2              change 2D-Circ > 2D-Obj
    DO NOT USE

ObjG2 UT2D_obj_ci3 ( Circ ci1  ) 

    UT2D_obj_ci3              change 3D-Kreis > 2D-Obj
    DO NOT USE

ObjG2 UT2D_obj_cv3 ( Curv cv1  ) 

    UT2D_obj_cv3              change 3D-Curve > 2D-Obj
    Die Indices (der Punktekette) sind in pc.x/pc.y.
    DO NOT USE

Point2 UT2D_pt_obj2 ( ObjG2 obj1  ) 

    UT2D_pt_obj2              2D-Obj > 2D-Point
    DO NOT USE

int UT2D_void_obj2 ( void *  memObj,
unsigned long *  oSiz,
ObjG2 og2 
)

    change ObjG2-Objekt -> data-Obj
    DO NOT USE

int UT2D_cv3_linear ( int *  pNr,
Point pTab,
double  tol 
)

    UT2D_cv3_linear              delete unnecesary straight points
    alle Punkte die innerhalb tol liegen aus pTab entfernen.
    ACHTUNG: pTab sind 3D-Punkte; Z ignorieren !

int UT2D_cv_inv ( int  ptNr,
Point2 pta 
)

UT2D_cv_inv Punktetabelle umdrehen

int UT2D_srar_polc ( double *  aro,
int  ptNr,
Point2 pa 
)

    UT2D_srar_polc                         nach Karl Sauer 2004-04-07
    Umlaufsinn (sr=sense of rotation) und Flaeche (ar=area) eines
    geschlossenen 2D-Polygons (polc) berechnen.
    
    ptNr = Anzahl Punkte ohne den letzten == ersten Punkt !
    pa   = PunkteTabelle ohne den letzten == ersten Punkt !
    RetCod = 1 = CCW
            -1 = CW

int UT2D_srar_inpt3 ( double *  aro,
int  ptNr,
int *  ipa,
Point pa 
)

    UT2D_srar_inpt3           Umlaufsinn und Flaeche eines indexed closed polygon
    UT2D_srar_inpt3                        nach Karl Sauer 2004-04-07
    Umlaufsinn (sr=sense of rotation) und Flaeche (ar=area) eines
    geschlossenen 2D-Polygons (polc) berechnen.
   
    Input:
      ptNr   Anzahl PunktIndices ohne den letzten == ersten Punkt !
      ipa    Indexarray into pa;
      pa     PunkteTabelle
    Output:
      RetCod = 1 = CCW
              -1 = CW

int UT2D_npt_ci ( Point2 pa,
int  pNr,
Circ2 ci1 
)

    UT2D_npt_ci               circular polygon
    see also UT2D_cv_cin UT2D_pt_rotptangr

void UT2D_cv_ci360 ( Point2 cv,
int  ptNr,
double  rd,
Point2 ptCen 
)

    Vollkreis --> Polygon.
    insgesamt ptNr Punkt; erster und letzter sind gleich.

int UT2D_cv_ln ( Point2 cv,
int  ptAnz,
Point2 p1,
Point2 p2 
)

    UT2D_cv_ln         Linearstueck -> Polygon.

int UT2D_cv_ci_ ( Point2 pa,
int *  ptNr,
Circ2 ci1,
int  ptMax,
double  tol 
)

UT2D_cv_ci_ get circular polygon from circle

int UT2D_cv_ci ( Point2  cv[],
int *  ptanz,
Point2 pa,
Point2 pe,
Point2 pm,
int  idiv 
)

    UT2D_cv_ci                change circle > polygon
    
    nur CCW. Max 64 Segments. Sehr schnell.
    Erstes und letztes Segment haben unterschiedliche Groesse.
    
    the circle is divided into 64/idiv segments.

double UT2D_lenB_2pt ( Point2 p1,
Point2 p2 
)

UT2D_lenB_2pt longest dx/dy-distance point-point (fast!)

int UT2D_minLenB_4pt ( double *  dp,
Point2 p1a,
Point2 p1e,
Point2 p2a,
Point2 p2e 
)

    UT2D_minLenB_4pt          min lenght between 2 lines
    dp ist Streckensumme entlang der Hauptachsen - nicht genau Laenge !
    rc = 1  p1e - p2a hat geringsten Abstand
    rc = 2  p1a - p2a hat geringsten Abstand
    rc = 3  p1e - p2e hat geringsten Abstand
    rc = 4  p1a - p2e hat geringsten Abstand
    dx,dy addieren; den geringsten Wert auswaehlen.

int UT2D_pt_ck_int4pt ( Point2 pi1,
Point2 pi2,
Point2 pi3,
Point2 pi4 
)

    test ob die Linien p1-p2 und p3-p4 sich schneiden/beruehren/parallel sind
    rc=-1: kein Schnittpunkt
    rc=0:  die  Linien beruehren sich
    rc=1:  die Linien sind (teilweise) parallel
    rc=2:  die Linien schneiden sich
    see UT2D_pt_int2vc2pt

int UT2D_i4pt_npt ( int *  ixMin,
int *  ixMax,
int *  iyMin,
int *  iyMax,
int  pNr,
Point2 ptab 
)

    UT2D_i4pt_npt                   find indices of extreme-points;
      (highest, lowest, leftmost, rightmost)
   
    see also UT3D_ipt2_nptvc UT3D_box_pts

double UT2D_ar_3pt ( Point2 p1,
Point2 p2,
Point2 p3 
)

    UT2D_ar_3pt            get (signed) area of triangle
   
    see also UT2D_srar_inpt3 UFA_ar_fac

int UT2D_pt_ck_onLine ( Point2 po,
Point2 p1,
Point2 p2,
Point2 p3 
)

    liegt p3 auf der Linie p1-p2 ?      (Tests mit UT_TOL_pt)
    RC = -1   NO; Point outside Line p1-p2
    RC =  0   Yes; p3=p1; po=p1.
    RC =  1   Yes; po between p1-p2
    RC =  2   Yes; p3=p2; po=p2.

int UT2D_pt_ck_inLine ( Point2 p1,
Point2 p2,
Point2 p3,
double  tol 
)

    UT2D_pt_ck_inLine      check 2D-point on line segment
    
    
    Check if a 3. 2D-point lies inside the line segment defined by two 2D-points.
    It is assumed that the 2D-point is ON the line defined by the two 2D-points.
    
    IN:
      Point2 p1   ... 2D-point 1 defining the line segment
      Point2 p2   ... 2D-point 2 defining the line segment
      Point2 p3   ... 2D-point to check
      double tol  ... tolerance for 2D-point to ly inside line segment (>0)
    OUT:
    Returncodes:
      0 = the 2D-point lies outside the segment
      1 = the 2D-point lies inside the segment

int UT2D_pt_ck_inplg ( Point2 pTab,
int  pNr,
Point2 ptx 
)

    UT2D_pt_ck_inplg       Test if Point ptx is inside polygon pTab
    Input:
      pTab   polygonPoints; closing edge is from pTab[pNr-1] to pTab[0]
    Output:
      RetCod 0     No,  point ptx is outside pTab;
             else  Yes, point is inside.

int UT2D_pt_ck_linear ( int  np,
Point2 ptab,
double  tol 
)

    UT2D_pt_ck_linear       check straight position of 2D-points
    
    Check if the position of 2D-points is straight.
    IN:
      int np        ... number of 2D-points
      Point2 *ptab  ... 2D-points
      double tol    ... tolerance for straightness (>0)
    OUT:
    Returncodes:
      0 = position of points is not straight
      1 = position of points is straight

int UT2D_pt_ck_inpt2vc ( Point2 px,
Point2 po,
Vector2 v1,
Vector2 v2 
)

    UT2D_pt_ck_inpt2vc        check if px is between vectors po-v1, po-v2.
    po = common point.  OpeningAngle v1-v2 must have < 180 deg.
    -2   openingAngle is 0 or 180 deg;
    -1   px is outside po-v1, po-v2
     0   px is between po-v1, po-v2
     1   px is on po-v1
     2   px is on po-v2
     3   px == po
   
                            /
                         v2/     px (inside)
          (outside)       /
                         /
                     po +----------
          (outside)             v1
   
    see also UT2D_sid_3pt UT2D_sid_ptvc UT2D_sidPerp_2vc

int UT2D_pt_ck_inAc ( Point2 pt,
Circ2 ci 
)

    UT2D_pt_ck_inAc          check if pt is in Arc(Segment)
    Vektor Cen-Pt muss Arc schneiden; else not in Arc.
    Es wird der Radius nicht kontrolliert; auch nicht die gegenUeberseite.
    RetCod: 0 = yes, pt is in Arcsegment;
           -1,-2,1,2 = no.

int UT2D_pt_ck_inCv3 ( Point ptx,
int  pNr,
Point pTab 
)

    UT2D_pt_ck_inCv3              check if point is inside polygon
    geschlossene Kontur erforderlich; pTab[pNr-1] muss gleich wie pTab[0] sein
    irc  1   Punkt liegt innerhalb der Kontur
    irc  0   Punkt liegt auf der Kontur
    irc -1   Punkt liegt ausserhalb der Kontur
    
    Schnittpunkte aller Kantenlinien mit Horzontale Linie durch ptx
    rechts von ptx zaehlen; ungerade == innen.

int UT2D_pt_cknear_npt ( Point2 p0,
Point2 ptTab,
int  ptNr 
)

    UT2D_pt_cknear_npt        return index of nearest Point from n points
    
    use: pt1 = ptTab[UT2D_ipt_cknear_npt (&ptStart, ptTab, ptNr)];

int UT2D_ci_ptvcci ( Point2 pc2,
Point2 pi,
double *  r2,
Point2 pt,
Vector2 vct,
Point2 pc1,
double  r1 
)

    UT2D_ci_ptvcci            durch Punkt+Richtung, tangential an Circ (pc+r)
    compute circle. Inputs:
             pt = point on circ,
             vct = tangent to circ tru point pt
             touching circle (center=pc1, radius=r1)
             *r2 > 0: Solution 1
             *r2 < 0: Solution 2
    
    Input:
      pt    definiert mit vct einen Durchgangspunkt mit Tangente
      vct   zeigt in Richtung pc1 (fuer oben/unten-Betrachtung)
      r2    1:  oberer Kreis,
            -1: unterer Kreis gewuenscht.
    Out:
      pc2   Mittelpunkt
      pi    der gemeinsame Punkt
      r2    Radius ist positiv, wenn gegenlaeufig,
            Radius negativ wenn gleichlaeufig.
    Returncode:
      0     OK, Aussenkreis
      1     OK, Innenkreis (ACHTUNG: oben/unten vertauscht)
     -1     Radius unendlich = eine Line von pi - pt.
     -2     pt liegt am Kreis pc1/r1; Loesung unmoeglich

int UT2D_ci_ptvcptvc ( Point2 pc,
Point2 p2,
double *  crad,
Point2 p1,
Vector2 v1,
Point2 pt,
Vector2 vt 
)

     Kreismittelpunkt jenes Kreises errechnen, der 
    - durch Punkt p1 geht und in diesem Punkt Richtung vc1 hat und
    - tangential an die Linie pt - vct ist.
    
    Input:
      p1
      vc1
      pt
      vct   Richtung muss mit vc1 uebereinstimmen !
    
    Output:
      pc  Mittelpkt
      p2  an diesem Punkt beruehrt der Kreis pt - vct
      rad
    
    Returncode:
      0  Kreisbogen < 180 Grad
     -1  Kreisbogen > 180 Grad

int UT2D_vc_cipt ( Vector2 vc1,
Point2 pc,
Point2 pt,
int  cdir 
)

den TangentialVektor an einem Punkt pt des Kreises errechnen

int UT2D_ci_ci3 ( Circ2 ci2,
Circ ci3 
)

UT2D_ci_ci3 2D-Circ = 3D-Circ

int UT2D_ci_ptrd ( Circ2 ci,
Point2 ptc,
double  rdc 
)

UT2D_ci_ptrd 360-deg 2D-Circ from center, radius

int UT2D_ci_pt2vcrd ( Circ2 ci2,
Point2 pc,
Vector2 vc1,
Vector2 vc2,
double *  rdc 
)

int UT2D_ci_ptvcpt ( Point2 pc,
double *  radc,
Point2 ps,
Vector2 vcs,
Point2 pe 
)

     circ from point and point+tangentVector
    
    Input:
      ps     = Startpunkt des Cir,
      vcs    = Startvektor
      pe     = ein Punkt am Kreis
    Output:
      pc     = Mittelpunkt
      radc   = Radius; ACHTUNG: negativ bei CW

int UT2D_m2_invtravcm2 ( Mat_3x2  im1,
Mat_3x2  m1 
)

    UT2D_m2_invtravcm2         invert 2D-vector transformation
    
    Inversion of a 2D-vector transformation.
    
    IN:
      Mat_3x2 m1  ... transformation matrix
    OUT:
      Mat_3x2 im1 ... inverse transformation matrix
    Returncodes:
      0 = OK
      1 = no inverse trafo

void UT2D_m2_load ( Mat_3x2  ma,
Vector2 vc1,
Point2 ori 
)

UT2D_m2_load 2D-Refsys from baseDirection, basePoint.

void UT2D_m2_loadtravcm2 ( Mat_3x2  ma,
Vector2 vx,
Vector2 vy,
Vector2 vt 
)

    UT2D_m2_loadtravcm2      load 2D-vector trafo (3x2 matrix)
    
    Load a 2D-vector transformation with 3x2-matrix.
    
    IN:
      Vector2 *vx  ... vector 1
      Vector2 *vy  ... vector 2
      Vector2 *vt  ... translation vector
    OUT:
      Mat_3x2 ma   ... transformation matrix

void UT2D_m2_init_rot ( Mat_3x2  ma,
double  angle 
)

UT2D_m3_init_rot Initialize a 3x2 - matrix with rotation

void UT2D_pt_traptm2 ( Point2 p2,
Mat_3x2  mata,
Point2 p1 
)

     UT2D_pt_traptm2         einen 2D-Punkt mit 3x2-Matrix transformieren.
    
    - transform point von Refsys ma nach absolut (mit normaler Matrix)
    - transform point von absolut Refsys ima   (mit inverser Matrix)
    
     Ausgabe: ein Punkt im 2D-System mata, gedreht um Center/Vektor in mata.

int UT2D_lncoe_ln ( double *  k,
double *  d,
Line2 ln 
)

    UT2D_lncoe_ln       coefficients of 2D Line
    
    Coefficients of 2D-Line equation y = k*x + d, if the line is
    NOT parallel to the y-axis.
    
    IN:
      Line2 *ln    ...  2D-line
    OUT:
      double *k    ...  coefficient k
      double *d    ...  coefficient d
    Returncodes:
      0 = OK
      1 = line parallel y-axis

int UT2D_ln_pts_dmax ( Line2 ln,
int  np,
Point2 ptab,
double  tol 
)

    UT2D_ln_pts_dmax          line <-- points with max. distance of pointTab.
    
    Computation of a 2D-line from a set of 2D-points.
    The line points will be such that their distance is maximal!
    Die am weitesten auseinanderliegenden Punkte suchen, Linie davon machen.
    
    IN:
      int np       ... number of 2D-points
      Point2 *ptab ... 2D-points
      double tol   ... tolerance: minimal desired distance between
                                  2D-line points
    OUT:
      Line2 *ln    ... 2D-line with maximal point distance
    Returncodes:
      1: line exists
      0: no line exists

int UT2D_2parvc_3vc ( double *  dx,
double *  dy,
Vector2 v1,
Vector2 v2,
Vector2 v3 
)

    UT2D_2parvc_3vc project end of vec1 along vec2 on vec3
   
    Zu gegebenen Vektoren v1, v2, v3 finden wir Zahlen x und y so,
    dass x * v1 + y * v3 = v2.
   
    dx/dy sind zwischen 0 bis 1; wenn dx=0.5 liegt der Endpunkt von V2
    genau in der Mitte des Parallelogramss V1-V3.
   
     y
      \
       \                        V1,V2,V3 have same startpoint s.
     dy \-----------x
         \         / \
          \       /   \
        V3 \    V2     \
            \   /       \
             \ /         \
              s----------------------------x
                         dx          V1

int UT2D_ptNr_ci ( double  rdc,
double  ao,
double  tol 
)

Anzahl Ecken circ berechnen

void UT2D_pt_traptm3 ( Point2 p2,
Mat_4x3  mata,
Point2 p1 
)

    UT2D_pt_traptm3           apply transformation to point (from 4x3-matrix)
    p2 und p1 duerfen ident sein


Generated on Sat May 30 09:31:55 2009 for gCAD3D by  doxygen 1.5.6