gCAD3D 2.35
ut_transform.c File Reference

transformations UTRA_ More...

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../ut/ut_geo.h"
#include "../ut/ut_ox_base.h"
#include "../ut/ut_TX.h"
#include "../db/ut_DB.h"
#include "../ut/func_types.h"

Macros

#define TRA_TAB_SIZ   10
 

Functions

int UTRA_app_pt (Point *, Point *)
 
int UTRA_app_vc (Vector *, Vector *)
 
int UTRA_dump__ ()
 
int UTRA_app_ox (ObjGX *ox2, ObjGX *ox1, Memspc *wrkSpc)
 
int UTRA_def__ (int trNr, int typ, void *data)
 
int UTRA_nobj_tra (ObjGX *oao, int oNr, ObjGX *oai, Memspc *objSeg, Memspc *tmpSeg)
 
int UTRA_app_dbo (long *dbi, int *typ, Memspc *wrkSpc)
 
int UTRA_app_CCV (CurvCCV *objo, CurvCCV *obji, Memspc *wrkSpc)
 
int UTRA_app__ (void *objo, int otyp, int oform, int iNr, void *obji, Memspc *wrkSpc)
 
int UTRA_app_x (void **poo, int otyp, int iNr, void *obji, Memspc *wrkSpc)
 
int UTRA_app_pt2 (Point2 *p2, Point2 *p1)
 
int UTRA_tra_pt2 (Point2 *p2, Point2 *p1, int typ, TraRot *tra)
 
int UTRA_tra_pt (Point *p2, Point *p1, int typ, TraRot *tra)
 
int UTRA_tra_vc (Vector *v2, Vector *v1, int typ, TraRot *tra)
 
int UTRA_inirotZ_pt_angr (TraRot *tr1, Point *ptOri, double ar)
 
int UTRA_inirot_pt_vc_angr (TraRot *tr1, Point *pa, Vector *va, double ar)
 
void UTRA_m3_multm3 (Mat_4x3 m3, Mat_4x3 ma, Mat_4x3 mb)
 
int UTRA_obj2_obj3__ (void **o2, int *typ2, void *o3, int typ3, Memspc *ma)
 
int UTRA_obj_abs2rel__ (void *robj, int typ, void *aobj, Memspc *memDat1)
 
int UTRA_tra_pln (Plane *pl2, Plane *pl1)
 
int UTRA_inirot_2vc (TraRot *tra1, Point *pto, Vector *vc1, Vector *vc2)
 
int UTRA_obj_rel2abs__ (void *aobj, int typ, void *robj, Memspc *memDat1)
 
int UTRA_pt_ucs2wcs (Point *pt1)
 
int UTRA_pt_wcs2ucs (Point *pt1)
 
int UTRA_tra_plg (CurvPoly *cvo, CurvPoly *cvi, Memspc *memSpc)
 
int UTRA_tra_cbsp (CurvBSpl *cvo, CurvBSpl *cvi, Memspc *memSpc)
 
int UTRA_tra_ell (CurvElli *cvo, CurvElli *cvi)
 
int UTRA_tra_ci (Circ *cvo, Circ *cvi)
 

Variables

int WC_sur_ind
 Der Index auf die ActiveConstrPlane. More...
 
Mat_4x3 WC_sur_mat
 
Mat_4x3 WC_sur_imat
 inverse TrMat of ActiveConstrPlane More...
 
static int TRA_NR = 0
 
static int TRA_TYP [TRA_TAB_SIZ]
 
static TraRot TRA_TAB [TRA_TAB_SIZ]
 

Detailed Description

transformations UTRA_

=====================================================
List_functions_start:
UTRA_obj_coordSys_pln change coordinateSytem onto refSys from plane or back
UTRA_obj_abs2rel__ obj from 3D-absolut onto 3D-constructionPlane
UTRA_obj_rel2abs__ obj from 3D-constructionPlane to 3D-absolut
UTRA_obj2_obj3__ curves from 3D-constructionPlane to 2D (removes Z-coord)
UTRA_inirot_pt_vc_angr define rotation um eine freie Achse
UTRA_inirotZ_pt_angr define rotation around z-axis; (center, angle)
UTRA_inirot_2vc define rotation-transformation between 2 vectors
UTRA_def__ define transformation (translation/rotation)
UTRA_nobj_tra apply transf. to ObjGX-Table
UTRA_app_dbo transform DB-object (typ,DB-ind) and store in DB
UTRA_app_out apply transformation, copy into outputspace
UTRA_app__ apply transformation,
UTRA_app_x apply Transformation to struct; NOT object.
UTRA_app_ox apply Transformation to complex-obj
UTRA_app_pt apply all defined Transformations to a point
UTRA_app_pt2 apply all defined Transformations to a 2D-point
UTRA_app_vc apply all defined Transformations to a vector
UTRA_app_CCV transform CCV
UTRA_app_dbo transform DB-object and store as dynam. obj.
UTRA_tra_pt apply a single Transformation to a point
UTRA_tra_pt2 apply a single Transformation to a 2D-point
UTRA_tra_vc apply a single Transformation to a vector
UTRA_tra_pln transform refSys
UTRA_pt_wcs2ucs transform point absolut to constructionPlane
UTRA_pt_ucs2wcs transform point constructionPlane to absolut
UT3D_m3_multm3 der Nutzen ist unbekannt ....
UTRA_dump__ dump translation-data
UTRA_app_obj DO NOT USE apply transf. to object (ObjGX-tree)
UTRA_app_oTab DO NOT USE apply transf. to ObjGX-table
List_functions_end:
=====================================================
- see also:

Macro Definition Documentation

#define TRA_TAB_SIZ   10

Function Documentation

int UTRA_app_pt ( Point p2,
Point p1 
)

apply all defined Transformations to a point.

int UTRA_app_vc ( Vector v2,
Vector v1 
)

apply all defined Transformations to a Vector.

int UTRA_dump__ ( )

UTRA_dump__ dump translation-data

int UTRA_app_ox ( ObjGX ox2,
ObjGX ox1,
Memspc wrkSpc 
)

UTRA_app_ox apply Transformation to complex-obj

int UTRA_def__ ( int  trNr,
int  typ,
void *  data 
)
UTRA_def__ define transformation
Input:
trNr immer mit 1 beginnen; max TRA_TAB_SIZ.
typ Typ_VC data must be: Vector (Translation)
Typ_TraRot TraRot (Rotation)
Typ_TraMat Mat_4x3 (Transformation)
Example:
UTRA_def__ (1, Typ_VC, &vc1);
UTRA_app__ (objo, oTyp, .. oDat, memSeg);
int UTRA_nobj_tra ( ObjGX oao,
int  oNr,
ObjGX oai,
Memspc objSeg,
Memspc tmpSeg 
)
UTRA_nobj_tra apply transf. to ObjGX-Table
nur die oNr primaeren ObjGX nach oo kopieren, alle daten nach SpcObj.
Die Transformation muss mit UTRA_def__ geladen werden.
see UTO_ox_tra UTRA_app_obj
int UTRA_app_dbo ( long *  dbi,
int *  typ,
Memspc wrkSpc 
)
UTRA_app_dbo transform DB-object (typ,DB-ind) and store in DB
Returns new (dynamic) index in dbi.
Transform objects from inside a struct (eg SurRev axis or contour)
Input:
dbi DB-index of obj to transform and to store
typ dbtyp
wrkSpc memspc for Typ_CVPOL and Typ_CVBSP; else can be NULL
Output:
dbi DB-index of new stored obj (dyn.obj!)
typ exact type of curve or surf
int UTRA_app_CCV ( CurvCCV objo,
CurvCCV obji,
Memspc wrkSpc 
)

UTRA_app_CCV transform CCV objo outputobj (a single CurvCCV) wrkSpc for additional data, eg pTab for Polygon

int UTRA_app__ ( void *  objo,
int  otyp,
int  oform,
int  iNr,
void *  obji,
Memspc wrkSpc 
)

UTRA_app_out apply transformation, copy into outputspace Input: otyp is the type of struct of obji oform type of obji obji struct-type of obji iNr nr of structs in obji Output: objo struct of type otyp/oform, data in wrkSpc size: same as obji or OBJ_SIZ_MAX bytes SABNT: returns parent-record (ObjGX) RetCod type of struct (0|1) from UTO_ck_dbsTyp

int UTRA_app_x ( void **  poo,
int  otyp,
int  iNr,
void *  obji,
Memspc wrkSpc 
)
apply Transformation to struct; NOT object.
init Transformation with UTRA_def__
objo must have appropriate size (>= OBJ_UNKNOWN or UTO_siz_stru(otyp))
Input:
otyp form of obji;
obji struct(s) to be transformed. Typ_Index=Typ_ObjGX
iNr nr of structs to transform (obji has <iNr> structs of typ <otyp>)
wrkSpc memspc for data
Output:
poo obj with new coordinates; obj-typ=otyp; spc in wrkSpc
RetCod 0=OK; -1=EOM
see UTO_obj_tra_m3 oder UTO_ox_tra
TODO: add parameter outTyp (now: outTyp == inTyp).
int UTRA_app_pt2 ( Point2 p2,
Point2 p1 
)

apply all defined Transformations to a 2D-point.

int UTRA_tra_pt2 ( Point2 p2,
Point2 p1,
int  typ,
TraRot tra 
)
apply a single Transformation to a 2D-point.
see also UT3D_pt_traptm3 UTRA_pt_traptm3
int UTRA_tra_pt ( Point p2,
Point p1,
int  typ,
TraRot tra 
)
apply a single Transformation to a point.
see also UT3D_pt_traptm3 UTRA_pt_traptm3
int UTRA_tra_vc ( Vector v2,
Vector v1,
int  typ,
TraRot tra 
)

apply a single Transformation to a Vector.

int UTRA_inirotZ_pt_angr ( TraRot tr1,
Point ptOri,
double  ar 
)
UTRA_inirotZ_pt_angr define rotation around z-axis (center, angle)
ptOri centerpoint of rotation; NULL=centerposition
ar angle in radians
int UTRA_inirot_pt_vc_angr ( TraRot tr1,
Point pa,
Vector va,
double  ar 
)

transformation from rotationaxis (pa, va) and angle (ar)

void UTRA_m3_multm3 ( Mat_4x3  m3,
Mat_4x3  ma,
Mat_4x3  mb 
)

UT3D_m3_multm3 4x3-Matrix mit 4x3 Matrix multiplizieren (nur den 3x3-Anteil)

int UTRA_obj2_obj3__ ( void **  o2,
int *  typ2,
void *  o3,
int  typ3,
Memspc ma 
)
get curves from 3D-constructionPlane to 2D
removes Z-coordinate !
int UTRA_obj_abs2rel__ ( void *  robj,
int  typ,
void *  aobj,
Memspc memDat1 
)

robj must have appropriate size (OBJ_UNKNOWN or UTO_siz_stru(typ)) Input: oSiz (free) size of objo; memspc memspc for Typ_CVPOL and Typ_CVBSP; else can be NULL Output: rbjo obj with new coordinates; obj-typ=typ; size: same as aobj or OBJ_SIZ_MAX bytes oSiz remaining free size of objo;

int UTRA_tra_pln ( Plane pl2,
Plane pl1 
)

transform refSys pl1 with transformation (axis,angle)

int UTRA_inirot_2vc ( TraRot tra1,
Point pto,
Vector vc1,
Vector vc2 
)
UTRA_inirot_2vc define rotation-transformation between 2 vectors
RetCod: 0 OK, transformation in ma1 defined;
1 vc1-vc2 are parallel (same direction); ma1 not defined.
-1 vc1-vc2 are antiparallel; ma1 not defined.
int UTRA_obj_rel2abs__ ( void *  aobj,
int  typ,
void *  robj,
Memspc memDat1 
)
put obj from 3D-constructionPlane to 3D-absolut
aobj must have appropriate size (OBJ_UNKNOWN or UTO_siz_stru(typ))
Input:
oSiz (free) size of objo;
memspc memspc for Typ_CVPOL and Typ_CVBSP; else can be NULL
Output:
abjo obj with new coordinates; obj-typ=typ;
size: same as robj or OBJ_SIZ_MAX bytes
oSiz remaining free size of objo;
int UTRA_pt_ucs2wcs ( Point pt1)

translate point from constructionplane (relativ) to absolut (UCS -> WCS)

int UTRA_pt_wcs2ucs ( Point pt1)

translate point from absolut to relativ (constructionplane) (WCS -> UCS)

int UTRA_tra_plg ( CurvPoly cvo,
CurvPoly cvi,
Memspc memSpc 
)
int UTRA_tra_cbsp ( CurvBSpl cvo,
CurvBSpl cvi,
Memspc memSpc 
)
int UTRA_tra_ell ( CurvElli cvo,
CurvElli cvi 
)
int UTRA_tra_ci ( Circ cvo,
Circ cvi 
)

Variable Documentation

int WC_sur_ind

Der Index auf die ActiveConstrPlane.

Mat_4x3 WC_sur_mat

TrMat of ActiveConstrPlane only if (WC_sur_ind > 0)

Mat_4x3 WC_sur_imat

inverse TrMat of ActiveConstrPlane

int TRA_NR = 0
static
int TRA_TYP[TRA_TAB_SIZ]
static
TraRot TRA_TAB[TRA_TAB_SIZ]
static