gCAD3D 2.35
ut_geo2d.c File Reference

2D geometric point vector line circle More...

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "../ut/func_types.h"
#include "../ut/ut_geo.h"
#include "../ut/ut_ox_base.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_const.h"
#include "../ut/ut_tol_const.h"
#include "../ut/ut_geo_const.h"

Macros

#define INCLUDE_FULL
 

Functions

int UT2D_npt_npt (Point2 *p2a, Point *pa, int pNr)
 
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)
 
double UT2D_angr_set_2angr (double as, double aa, int sr)
 
int UT2D_angr_set (double *angr)
 
int UT2D_angd_set (double *angd)
 
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_bc (double *q, double *hc, double b, double c)
 
int UT2D_solvtriri_p_q_hc (double *p, double q, double hc)
 
int UT2D_solvtriri_p_b_q (double *p, double b, double q)
 
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_vc_vc__ (Vector2 *vac, Vector2 *vab)
 
double UT2D_slen_nor3pt (Point2 *p1, Point2 *p2, Point2 *p3)
 
double UT2D_slen_nor_2pt_vcNo (Vector2 *v1, Point2 *p1, Point2 *p2)
 
int UT2D_slen_nor2vc (double *slen, Vector2 *v1, Vector2 *v2)
 
int UT2D_slen_nor_vc_vcNo (double *slen, Vector2 *v1, Vector2 *v2)
 
int UT2D_2slen_vc_vc__ (double *dx, double *dy, Vector2 *vp, Vector2 *vl)
 
int UT2D_2slen_2pt_vc__ (double *dx, double *dy, Point2 *px, Point2 *pl, Vector2 *vl)
 
int UT2D_nlenq_3pt (double *qlen, Point2 *pa, Point2 *pb, Point2 *pc)
 
int UT2D_nlenq_2vc (double *qlen, Vector2 *vab, Vector2 *vac)
 
void UT2D_2len_ptvc (double *dx, double *dy, Point2 *pt, Point2 *pb, Vector2 *vc)
 
int UT2D_angr_2vc_sr (double *ao, Vector2 *vc1, Vector2 *vc2, int sr)
 
double UT2D_angr_ci (Point2 *pa, Point2 *pe, Point2 *pc, double rad_in)
 
int UT2D_circQuad23_angr (double *ar)
 
int UT2D_circQuad34_angr (double *ar)
 
double UT2D_angr_perpangr (double *ai)
 
double UT2D_len_cir (double *angOpe, Point2 *pa, Point2 *pe, Point2 *pc, double rad_in)
 
double UT2D_slen_pt_pt_vc__ (Point2 *pc, Point2 *pa, Vector2 *vab)
 
double UT2D_slen_nor_2pt_vc__ (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_par_2vc (double *pl, Vector2 *v1, Vector2 *v2)
 
int UT2D_par_3pt (double *pl, Point2 *p1, Point2 *p2, Point2 *p3)
 
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, double *tol, 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_2par_int2pt2vc (double *par1, double *par2, Point2 *pa, Vector2 *vab, Point2 *pc, Vector2 *vcd)
 
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 (Vector2 *v1, Vector2 *v2, double tol)
 
int UT2D_sidPerp_2vc (Vector *v1, Vector *v2)
 
int UT2D_ckvc_hori (Vector2 *vc1)
 
int UT2D_ckvc_vert (Vector2 *vc1)
 
int UT2D_ckvc_in2vc (Vector2 *v1, Vector2 *v2, Vector2 *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)
 
int UT2D_2par_vc_vcx_vcy (double *dx, double *dy, Vector2 *vc1, Vector2 *vcx, Vector2 *vcy)
 
int UT2D_vc_tra_vcx_vcy (Vector2 *vco, Vector2 *vci, Vector2 *vcx, Vector2 *vcy)
 
void UT2D_vc_travcm2 (Vector2 *vo, Mat_3x2 mata, Vector2 *vi)
 
double UT2D_sDist_ciSeg (double rd, double as)
 
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)
 
int UT2D_ck_ci360 (Circ *ci1)
 
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_ci2 (Circ2 *ci1)
 
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_inpt (double *aro, int ptNr, int *ipa, Point2 *p2a)
 
int UT2D_srar_inpt3 (double *aro, int ptNr, int *ipa, Point *pa)
 
int UT2D_srar_3pt (double *aro, Point2 *p0, Point2 *p1, Point2 *p2)
 
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, double tol)
 
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_cic_ci3 (Circ2C *ci2c, Plane *pl1, Circ *ci3)
 
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 angr, Point2 *ptCen)
 
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)
 
int UT2D_pt_cic_par (Point2 *pto, double *par, Circ2C *cic)
 
int UT2D_ptx_ci_pty (double *ptx, double *pty, double *rd)
 
int UT2D_pt_par_ci (Point2 *pto, double du, Circ2 *ci)
 
int UT2D_pt_parvc_pt_vc (Point2 *pt, Point2 *p0, double lp, Vector2 *vc)
 
int UT2D_parvc_2vc (double *lp, Vector2 *v1, Vector2 *v2)
 
int UT2D_ckvc_inA_vc_vc (Vector2 *v1, Vector2 *v2, Vector2 *v3)
 
int UT2D_ckvc_parl (Vector2 *v1, Vector2 *v2, double tol)
 
int UT2D_ptx_tang_cic_pt (double *x0, double xp, double rdc)
 
int UT2D_pt_tng_ci_vc (Point2 *ptg, Circ2 *ci, Vector2 *vt, int isol)
 
int UT2D_pt_tng_ci_pt (Point2 *ptg, Circ2 *ci, Point2 *pt1, int isol)
 
int UT2D_pt_mid_npt (Point2 *ptc, Point2 *npt, int ptNr)
 

Detailed Description

2D geometric point vector line circle

=====================================================
List_functions_start:
-------------- 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_2angr set aa following as. Do not modify as.
UT2D_angr_set change to val >= 0 <= RAD_360
UT2D_angd_set change to val >= 0 <= 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_solvtri_abc scalene tri: q and hc from sides a, b and c
UT2D_solvtriri_p_q_hc right-angled tri: get p from q and hc
UT2D_solvtriri_p_b_q right-angled tri: get p from b and q
UT2D_solvtriri_bc right-angled tri: q and hc from sides 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_2vc_sr get opening angle of 2 vectors with sense of rot
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)
UT2D_circQuad23_angr returns if angle is quadrant 2 or 3 (CCW from 1-4)
UT2D_circQuad34_angr returns if angle is quadrant 3 or 4 (CCW from 1-4)
-------------- length -------------------------------------
UT2D_len_vc length of 2D-vector INLINE
UT2D_lenq_vc Quadr.Vectorlength INLINE
UT2D_lenS_vc dx+dy-distance 2D-vector INLINE
UT2D_len_2pt distance pt - pt
UT2D_lenB_2pt max(dx|dy)-distance point-point
UT2D_lenS_2pt dx+dy-distance point-point INLINE
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_slen_vc_vc__ signed length of vector on vector
UT2D_slen_vc_vcNo signed length of vector on norm.vector
UT2D_slen_pt_pt_vc__ signed length of point onto vector
UT2D_slen_nor2vc signed length of normal of 2 vectors
UT2D_slen_nor_vc_vcNo signed length of normal of 2 vectors (1 normalized)
UT2D_slenq_ptptvc signed quadr.Distance pt-pt in Richtung vec
UT2D_slen_nor_2pt_vc__ signed length of normal of point onto vector
UT2D_slen_nor_2pt_vcNo signed length of normal of point onto norm.vector
UT2D_slen_nor3pt signed length of normal of point - line
UT2D_nlenq_3pt give quadr.Distance from point to line
UT2D_nlenq_2vc give quadr.Distance from vec on vec (point to line)
UT2D_2slen_2pt_vc__ relative coords (dx,dy) of point along/normal to line
UT2D_2slen_vc_vc__ relative coords (dx,dy) of vector on vector
UT2D_minLenB_4pt min lenght between 2 lines
UT2D_len_cir length circular arc (pa,pe,pc,rad/dreh)
UT2D_len_cia length arc (from rad & angle) INLINE
UT2D_sDist_ciSeg height of segment of circle from angle
-------------- parameter -------------------------------------
// UT2D_parLn_pt2pt get parameter (0-1) of point px along line p1-p2
UT2D_parvc_2vc parameter of distance of vec1 projected on vec2
UT2D_par_3pt parameter of point projected on line from 2 points
-------------- 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_npt_npt tab of 2D-Points = tab of 3D-Points (copy X,Y)
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_mid_npt midpoint from n points
UT2D_pt_parvc_pt_vc point on Linesegment + parametric value.
UT2D_pt_cic_par get 2D-point from par on 2D-circ in centerPos
UT2D_pt_par_ci point on circle from parameter
UT2D_ptx_ci_pty x-val of point on circle from y-val on circle
UT2D_pt_traptvc 2D-Point = 2D-Point + 2D-Vector INLINE
UT2D_pt_traptvclen transl. point into dir vc dist. lenv
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_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_2par_int2pt2vc intersect 2 unlimitedLines; gives 2 parameters
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_ptx_tang_cic_pt get x-value where Y=0 of tangent to circle
UT2D_pt_tng_ci_vc tangent with fixed vector to circ
UT2D_pt_tng_ci_pt tangent from point (outside circ) to circ
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_hori test if vector is horizontal
UT2D_ckvc_vert test if vector is vertical
UT2D_ckvc_parl test if 2 vectors parallel
UT2D_ckvc_in2vc check if v2 is between v1 and v3
UT2D_ckvc_inA_vc_vc check if v2 is between v1 and v3 (parall.& antiparall.)
UT2D_parvc_2vc parameter of distance of vec1 projected on vec2
UT2D_2parvc_3vc project end of vec1 along vec2 on vec3
UT2D_vc_pt Vector from 0,0 -> point
UT2D_vc_2db 2D-Vector = 2 doubles (x, y)
UT2D_vc_vc3 2D-Vector from 3D-Vector INLINE
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_tng_ci_pt tangent to circ tru point on circ
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)
UT2D_vc_tra_vcx_vcy translate vector int refsys from vcx,vcy
-------------- Circ2C --------------------------------------
UT2D_cic_ci3 get 2D-circle in centerPosition from 3D-circ
-------------- Circ2 --------------------------------------
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_ck_ci360 check if circ is 360-degree-circ
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) DO NOT USE
UT2D_obj_ci2 change 2D-Circ > 2D-Obj DO NOT USE
UT2D_void_obj2 change ObjG2-Objekt -> data-Obj DO NOT USE
-------------- 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_3pt Umlaufsinn und Flaeche eines 2D-triangle
UT2D_srar_polc Umlaufsinn und Flaeche eines closed polygon
UT2D_srar_inpt Umlaufsinn und Flaeche eines indexed closed polygon
UT2D_srar_inpt3 Umlaufsinn und Flaeche eines indexed closed 3D-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
List_functions_end:
=====================================================

Macro Definition Documentation

#define INCLUDE_FULL

Function Documentation

int UT2D_npt_npt ( Point2 p2a,
Point pa,
int  pNr 
)
UT2D_npt_npt tab of 2D-Points = tab of 3D-Points (copy X,Y)
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

double UT2D_angr_set_2angr ( double  as,
double  aa,
int  sr 
)
UT2D_angr_set_2angr set aa following as. Do not modify as.
as startAngle; not modified.
aa following angle; must be > as for CCW; must be < as for CW.
sr 0=CCW; 1=CW
Output:
retVal if(sr==1) then retVal > as;
else retVal < as;
as and retVal may have identical position.
Examples:
as=0.; aa=1; sr=1; retVal=-5
int UT2D_angr_set ( double *  angr)

UT2D_angr_set change to val >= 0 <= RAD_360

int UT2D_angd_set ( double *  angd)

UT2D_angd_set change to val >= 0 <= 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 == 0 (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 (opening-angle)
irot = 0 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)
Input: the length of the sides b, c.
c length of baseline, from point A to point B;
b length of side left, from point A to point C;
Output:
a length of side right, from point B to point C;
Retcodes:
0 OK
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)
+
|\
| \
a| \c
| \
+----+
b
b=x*c;
a*a + x*x*c*c = c*c
c=sqrt(a*a/((x*x)-1)
Input:
a = length of side a
x = factor; b = c * x;
Output:
c = length of side c
0 OK
-1 Error (x=1)
int UT2D_solvtriri_bc ( double *  q,
double *  hc,
double  b,
double  c 
)
UT2D_solvtriri_ac right-angled tri: q and hc from sides b and c.
C Right angle is in point C
/ | \
/ | \
b hc a
/ | \
A -------c-------- B
q p
Input: the length of the sides a, b, c.
c is the baseline, from point A to point B;
b length of side left, from point A to point C;
Output:
q the length of b projected to c; (with direction - can be negativ !)
hc the length of the normal standing on c
hc parts c into q (lying under b) and p (lying under a)
Retcodes:
0 OK
-1 Error (b>c)
int UT2D_solvtriri_p_q_hc ( double *  p,
double  q,
double  hc 
)
UT2D_solvtriri_p_q_hc right-angled tri: get p from q and hc
C Right angle is in point C
/ | \
/ | \
b hc a
/ | \
A -------c-------- B
q p
Input: the length of the sides a, b, c.
q lenght from point A to intersection with hc
hc length of the normal standing on c
Output:
p the length of a projected to c
Retcodes:
0 OK
-1 Error (b>c)
int UT2D_solvtriri_p_b_q ( double *  p,
double  b,
double  q 
)
UT2D_solvtriri_p_b_q right-angled tri: get p from b and q
C Right angle is in point C
/ | \
/ | \
b hc a
/ | \
A -------c-------- B
q p
Input: the length of the sides a, b, c.
q lenght from point A to intersection with hc
hc length of the normal standing on c
Output:
p the length of a projected to c
Retcodes:
0 OK
-1 Error (b>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
Input: the length of the sides a, b, c.
c is the baseline, from point A to point B;
b length of side left, from point A to point C;
a length of side right, from point B to point C;
Output:
q the length of b projected to c; (with direction - can be negativ !)
hc the length of the normal standing on c
hc parts c into q (lying under b) and p (lying under a)
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)
returns 0 - RAD_360 (PI * 2)
Example: (1,1) returns RAD_45 (0.785)
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, giving e.
Returns the quadr. length pa - e.
pc
|
|
qlen |
pa--------+-----pb
e
RetCod erweitern;
-1 pc is left of pa (pc - pa - pb)
0 pc is between pa -pb (pa - pc - pb)
1 pc is right of pb (pa - pb - pc)
double UT2D_slen_vc_vc__ ( Vector2 vac,
Vector2 vab 
)
UT2D_slen_vc_vc__ signed length of vector on vector
both vector need not to be normalized.
If vab = normalized use UT2D_slen_vc_vcNo.
C
. | A-C = vector vac
. | A-B = vector vab
. |
. |
A-----_--+---------B
|--slen--|
Returns:
slen; negative if C is left of A-B
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.
p2
|
slen|
|
p1------+--------p3
double UT2D_slen_nor_2pt_vcNo ( Vector2 v1,
Point2 p1,
Point2 p2 
)
UT2D_slen_nor_2pt_vcNo signed length of normal of point onto norm.vector
For true length v1 must be normalized !
. p2
. .
. .
. .
v2 . sk = normal-distance of p2 onto vector p1-v1
. .
. .
. .
X-----------------.------->
p1 v1
int UT2D_slen_nor2vc ( double *  slen,
Vector2 v1,
Vector2 v2 
)
UT2D_slen_nor2vc signed length of normal of 2 vectors
both vectors need not to be normalized.
If v1 = normalized use UT2D_slen_nor_vc_vcNo.
x
/|
/ |
V2/ |
/ |
/ |slen
/ |
x------+-------x
V1
RetCode: 0 OK
-1 length v1 = 0
int UT2D_slen_nor_vc_vcNo ( double *  slen,
Vector2 v1,
Vector2 v2 
)
UT2D_slen_nor_vc_vcNo signed length of normal of 2 vectors (1 normalized)
v1 must be normalized (else slen *= length_of_V1)
x
/|
/ |
V2/ |
/ |
/ |slen
/ |
x------+-------x
V1
RetCode: 0 OK
-1 length v1 = 0
int UT2D_2slen_vc_vc__ ( double *  dx,
double *  dy,
Vector2 vp,
Vector2 vl 
)
UT2D_2slen_vc_vc__ relative coords (dx,dy) of vector on vector
vl need not to be normalized.
x
/|
/ |
vp/ |
/ |
/ |dy
/ |
x------+---vl---->
| dx |
RetCode: 0 OK
-1 length vl = 0
int UT2D_2slen_2pt_vc__ ( double *  dx,
double *  dy,
Point2 px,
Point2 pl,
Vector2 vl 
)
UT2D_2slen_2pt_vc__ relative coords (dx,dy) of point along/normal to line
vl need not to be normalized.
px
/|
/ |
vp/ |
/ |
/ |dy
/ |
pl------+---vl---->
| dx |
RetCode: 0 OK
-1 length vl = 0
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, giving e.
Returns the qadr.length pc - e.
pc
|
len|
|
pa------+-------pb
e
int UT2D_nlenq_2vc ( double *  qlen,
Vector2 vab,
Vector2 vac 
)
UT2D_nlenq_2vc give quadr.Distance from vec on vec (point to line)
pa - pb gives a line, pc is projected onto this line, giving e.
Returns the qadr.length pc - e.
pc
/|
vac/ |
/ |qlen
/ |
pa------+-------pb
vab
- 0 0.5 1.0 1.5
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 !)
int UT2D_angr_2vc_sr ( double *  ao,
Vector2 vc1,
Vector2 vc2,
int  sr 
)
UT2D_angr_2vc_sr get opening angle of 2 vectors with sense of rot
Input:
sr 1=CCW; else CW
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 ;
int UT2D_circQuad23_angr ( double *  ar)
UT2D_circQuad23_angr returns if angle is quadrant 2 or 3 (CCW from 1-4)
RetCod: 0 = angle is in quadrant 1 or 4
1 = angle is in quadrant 2 or 3 (>= 90 and <= 270 deg)
int UT2D_circQuad34_angr ( double *  ar)
UT2D_circQuad34_angr returns if angle is quadrant 3 or 4 (CCW from 1-4)
RetCod: 0 = angle is in quadrant 1 or 2
1 = angle is in quadrant 3 or 4 (>= 180 and <= 360 deg)
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_slen_pt_pt_vc__ ( Point2 pc,
Point2 pa,
Vector2 vab 
)
UT2D_slen_pt_pt_vc__ signed length of point onto vector
both vector need not to be normalized.
pc
. |
. |
. |
. |
pa--------+-----vab-->
|--slen--|
Returns:
slen; negative if C is left of A-B
double UT2D_slen_nor_2pt_vc__ ( Point2 pt,
Point2 pl,
Vector2 vl 
)
UT2D_slen_norvc2pt signed length of normal point onto vector
vl must not be normalized.
if vl = normalized: use UT2D_slen_nor_2pt_vcNo
. pt
. .
. .
. .
vp . sk = normal-distance of pt onto vector pl-vl
. .
. .
. .
X-----------------.------->
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)
X
vp . pt 1
.
p1------------vl--------p2->
X
pt -1
RetCode:
0 pt is on vector vl
1 pt is above vector vl (left side)
-1 pt is below vector vl (right side)
side before,behind: UT2D_sidPerp_3pt
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
X
pt 1
pl
----------X---vl-----------> 0
X
pt -1
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 pl+vc
pt | pt
-1 | 1
|
|--------->vl
----------X----------------
pl
|
retcode:
0 pt is on a normal to line pl-vl
1 pt is before pl (to the right side of a normal to line pl-vl)
-1 pt is behind pl (to the left side of a normal to line pl-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
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_par_2vc ( double *  pl,
Vector2 v1,
Vector2 v2 
)
UT2D_parvc_2vc parameter of distance of vec1 projected on vec2
V1,V2 have same startpoint s.
x
/|
/ |
V1 |
/ |
/ .|
s-----x---V2------->
< 0 0 pl=0.4 1 > 1
RetCodes:
0 OK
-1 v1-v2 aufeinander Normal; pl = 0.
int UT2D_par_3pt ( double *  pl,
Point2 p1,
Point2 p2,
Point2 p3 
)
UT2D_par_3pt parameter of point projected on line from 2 points
V1,V2 have same startpoint s.
p3
/|
/ |
V1 |
/ |
/ .|
p1-----x---V1-------p2
< 0 0 pl=0.4 1 > 1
RetCodes:
0 OK
-1 v1-v2 aufeinander Normal; pl = 0.
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
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,
double *  tol,
Point2 p1,
Point2 p2,
Point2 p3,
Point2 p4 
)
intersection of 2 limited lines, tolerance.
Info, ob Schnittpunkt ident mit p1 oder p2 (p3,p4 werden nicht getestet)
Info, ob p1-p2 und p3-p4 uebereinanderliegen (ueberlappen)
Output:
dp1 parameter along p1-p2
dp2 parameter along p3-p4
RC = -1 NO intersection.
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
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_2par_int2pt2vc ( double *  par1,
double *  par2,
Point2 pa,
Vector2 vab,
Point2 pc,
Vector2 vcd 
)
UT2D_2par_int2pt2vc intersect 2 unlimitedLines; gives 2 parameters
Input:
pa-vab Line1 (pa-pb)
pc-vcb Line2 (pc-pd)
Output:
par1 = Parameter of IntersectPt auf pa-pb
par2 = Parameter of IntersectPt auf pc-pd
irc = -1 = parallel
irc = 0 = OK;
d
/.
/ .
/ .
/ .
c .
.. .
. . .
. . .
a-----+---e----f-----------------------b
ip
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;
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 ( Vector2 v1,
Vector2 v2,
double  tol 
)
UT3D_cklr_2vc check vc for left (CCW, above) or right (CW, below)
Vektoren muessen nicht normiert sein !
RC 1 v2 is CCW from v1 (pos. angle)
RC 0 v1-v2 are parallel
RC -1 v2 is CW from v1 (neg. angle)
X
v1/ 1
/
----------X---v2-----------> 0
-1
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)
int UT2D_ckvc_hori ( Vector2 vc1)
UT2D_ckvc_hori test if vector is horizontal
vc1 should be normalized
RetCod:
0 = yes; vc1 is horizontal
1 = no; vc1 is not horizontal
int UT2D_ckvc_vert ( Vector2 vc1)
UT2D_ckvc_vert test if vector is vertical
vc1 should be normalized
RetCod:
0 = yes; vc1 is vertical
1 = no; vc1 is not vertical
int UT2D_ckvc_in2vc ( Vector2 v1,
Vector2 v2,
Vector2 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 = yes; v2 is between v1 and v3
1 = no; v2 = above (left of) v1 and v3
-1 = no; v2 = below (right of) 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 and vci may be the same address
if length of vci is known:
UT2D_vc_multvc (&vco, &vci, newLengthOfVco / actLengthOfVci);
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)
int UT2D_2par_vc_vcx_vcy ( double *  dx,
double *  dy,
Vector2 vc1,
Vector2 vcx,
Vector2 vcy 
)
UT2D_2par_vc_vcx_vcy get parameters of vector projected onto vx,vy
vcx and vcy must have length=1
vcy
^
|
|---dx---|
|
| x ---
| / |
| vc1/ |
| / dy
| / |
| / |
x---------------------> vcx
int UT2D_vc_tra_vcx_vcy ( Vector2 vco,
Vector2 vci,
Vector2 vcx,
Vector2 vcy 
)

UT2D_vc_tra_vcx_vcy translate vector int refsys from vcx,vcy Input: vcx,vcy refsys; vectorlenght 1.

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_sDist_ciSeg ( double  rd,
double  as 
)
UT2D_sDist_ciSeg height of segment of circle from angle
Winkel eines Kreisbogens von Sehnenhöhe Input: rd radius as angle of segment Output: ds Sehnenhöhe (max Abweichnung vom Kreisbogen) ----- -- | -- - |ds - ----------+----------- \ | / \ | / rd as / \ | / \ | / x.
Input:
rd radius
as angle of segment
Output:
ds Sehnenhöhe(max Abweichnung vom Kreisbogen) ----- -- | -- - |ds - ----------+----------- \ | / \ | / rd as / \ | / \ | / x (max Abweichnung vom Kreisbogen)
-----
-- | --
- |ds -
----------+-----------
\ | /
\ | /
rd as /
\ | /
\ | /
x
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.
int UT2D_ck_ci360 ( Circ ci1)
UT2D_ck_ci360 check if circ is 360-degree-circ
RC = 0: YES, is 360DegCirc
RC = 1: NO
if(UT2D_ck_ci360 == YES) ...
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üglRichtung 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); 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);. 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);. der Linie pt1/vc1,
aber hinter ptc (bezüglRichtung vc1, wie Lösung [1]) Retcode: 0=Error (Lines parallel); 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_ci2 ( Circ2 ci1)
UT2D_obj_ci2 change 2D-Circ > 2D-Obj
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_inpt ( double *  aro,
int  ptNr,
int *  ipa,
Point2 p2a 
)
UT2D_srar_inpt Umlaufsinn und Flaeche eines indexed closed polygon
UT2D_srar_inpt 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_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_srar_3pt ( double *  aro,
Point2 p0,
Point2 p1,
Point2 p2 
)
UT2D_srar_3pt Umlaufsinn und Flaeche eines 2D-triangle
UT2D_srar_3pt nach Karl Sauer 2004-04-07
Umlaufsinn (sr=sense of rotation) und Flaeche (ar=area) eines
geschlossenen 2D-Polygons (polc) berechnen.
Input:
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
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)
double UT2D_ar_3pt ( Point2 p1,
Point2 p2,
Point2 p3 
)
UT2D_ar_3pt get (signed) area of triangle
int UT2D_pt_ck_onLine ( Point2 po,
Point2 p1,
Point2 p2,
Point2 p3,
double  tol 
)
liegt p3 auf der Linie p1-p2 ? (Tests mit UT_TOL_pt)
Output:
po nearest point on line; (NULL; not computed)
retCod
-1 NO; Point outside Line p1-p2
0 Yes; p3=p1; po=p1.
1 Yes; po between p1-p2
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
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_cic_ci3 ( Circ2C ci2c,
Plane pl1,
Circ ci3 
)
UT2D_cic_ci3 get 2D-circle in centerPosition from 3D-circ
returns also its basPlne (use its vx, vy to transfer 2D-points -> 3D).
Example:
UT2D_cic_ci3 get 2D-circ and its plane from 3D-circ
UT2D_pt_cic_par get point on 2D-circ
UT3D_pt_tra_pt_2vc_2par get 3D-point from 2D-point.
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  angr,
Point2 ptCen 
)

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 
)
UT2D_ptNr_ci get nr of points for polygon from circ
Input:
rdc radius; must be pos.
ao opening angle in rad; must be pos.
tol deviation
Output:
retCod nr of points for polygon
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
int UT2D_pt_cic_par ( Point2 pto,
double *  par,
Circ2C cic 
)

UT2D_pt_cic_par get 2D-point from par on 2D-circ in centerPos

int UT2D_ptx_ci_pty ( double *  ptx,
double *  pty,
double *  rd 
)
UT2D_ptx_ci_pty Get x-val of point on circle from y-val on circle
x = sqrt (r*r - y*y) - phytagoras
y = sqrt (r*r - x*x)
ONLY QUADRANT 1 (use UT2D_circQuad23_angr)
int UT2D_pt_par_ci ( Point2 pto,
double  du,
Circ2 ci 
)

UT2D_pt_par_ci point on circle from parameter

int UT2D_pt_parvc_pt_vc ( Point2 pt,
Point2 p0,
double  lp,
Vector2 vc 
)
int UT2D_parvc_2vc ( double *  lp,
Vector2 v1,
Vector2 v2 
)
UT3D_parvc_2vc parameter of distance of vec1 projected on vec2
Output:
lp parameter; eg 0.5 = iproj. of end of v1 is in middle of v2
RetCode:
0 OK
-1 v1-v2 aufeinander Normal; pl = 0.
dl ist zwischen 0 bis 1; wenn dl=0.5 liegt der Endpunkt von V2
genau in der Mitte des Vektors V2. Mit Vorzeichen !
v1={0.5, 0.5, 0.}, v2={1., 0., 0.} gives pl = 0.5
v1={-0.5, 0.5, 0.}, v2={1., 0., 0.} gives pl = -0.5
v1={1.5, 0.5, 0.}, v2={1., 0., 0.} gives pl = 1.5
V1,V2 have same startpoint s.
x
/|
/ |
V1 |
/ |
/ |
s---------V2-------x
dl
int UT2D_ckvc_inA_vc_vc ( Vector2 v1,
Vector2 v2,
Vector2 v3 
)
UT2D_ckvc_inA_vc_vc check if v2 is between v1 and v3
test parellel and antiparallel; if(v1-v2 > 180 deg) invert v2.
the opening-angle of v1-v3 is less than 180 deg.
RetCod:
0 = yes; v2 is between v1 and v3
1 = no; v2 = above (left of) v1 and v3
-1 = no; v2 = below (right of) v1 and v3
int UT2D_ckvc_parl ( Vector2 v1,
Vector2 v2,
double  tol 
)
test if 2 vectors parallel
tol = max distance of v1 from v2.
BOTH VECTORS MUST BE NORMALIZED.
.
/ |
/ |
v1 tol
/ |
X ---v2---x------->
RetCod:
0 OK; parallel.
-1 not parallel.
int UT2D_ptx_tang_cic_pt ( double *  x0,
double  xp,
double  rdc 
)
get x-value where Y=0 of tangent to circle
Used for tangent to circle tru point on circle.
Input:
xp x-value of a point on the circle
rdc circle radius
Output:
x0 x-value of teh point of the tangent to circle where y=0
retCod: 0=OK; x0 set.
1=vertical; xp==rdc
2=horizontal; xp==0
int UT2D_pt_tng_ci_vc ( Point2 ptg,
Circ2 ci,
Vector2 vt,
int  isol 
)
int UT2D_pt_tng_ci_pt ( Point2 ptg,
Circ2 ci,
Point2 pt1,
int  isol 
)

UT2D_pt_tng_ci_pt tangent from point (outside circ) to circ RetCod: 1 point is on circle 0 OK -1 Error; pt1 inside circ.

int UT2D_pt_mid_npt ( Point2 ptc,
Point2 npt,
int  ptNr 
)

UT2D_pt_mid_npt midpoint from n points