ut_transform.c File Reference


Detailed Description

geom. Transformations UTRA_

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

UTRA_def__             define transformation
UTRA_nobj_tra          apply transf. to ObjGX-Table
UTRA_app__             apply transf. to struct (nicht ObjGX)
UTRA_app_obj           apply transf. to object (ObjGX-tree)
UTRA_app_oTab          apply transf. to ObjGX-table
UTRA_app_pt            apply all defined Transformations to a point
UTRA_tra_pt            apply a single Transformation to a point
UTRA_app_vc            apply all defined Transformations to a vector
UTRA_tra_vc            apply a single Transformation to a vector

UTRA_m3_inirot         define rotation um eine freie Achse
UTRA_m3_iniZrot        Drehung um die Z-Achse definieren
UT3D_m3_multm3         der Nutzen ist unbekannt ....

Liste_Funktionen_Ende:
=====================================================
- see also:
UT3D_m3_load
UT3D_m3_load_o
UT3D_m3_get
UT3D_m3_multm3

--------------------------------------------------------
Mat_4x3:
        VX             VY            VZ        Nullpunkt

  [0][0]=vx.dx   [0][1]=vy.dx  [0][2]=vz.dx   [0][3]=o.x
  [1][0]=vx.dy   [1][1]=vy.dy  [1][2]=vz.dy   [1][3]=o.y
  [2][0]=vx.dz   [2][1]=vy.dz  [2][2]=vz.dz   [2][3]=o.z
--------------------------------------------------------


- usage examples:

  // TRANSLATION:            (Obj verschieben)
  UT3D_vc_3db (&vc1, 15.,0.,5.);    // define a transl.vector
  UTRA_def__ (1, Typ_VC, &vc1);  // init translation-function
  UTRA_app__ ..


  // Z-ROTATION:
  // ptc ist Drehmittelpunkt (oder NULL)
  UTRA_m3_iniZrot (&tr1, &ptc, UT_RADIANS(45.));
  UTRA_def__ (1, Typ_TraRot, &tr1);
  UTRA_app__ ..


  // freie ROTATION:           (Obj drehen)
  // Drehachse pt0, vc0
  TraRot tr1;
  UTRA_m3_inirot (&tr1, &pt0, &vc0, UT_RADIANS(30.));
  UTRA_def__ (1, Typ_TraRot, &tr1);
  UTRA_app__ ..


  // TRANSFORMATION:  (obj von einer Plane in Nullage transportieren   oder
  //                  aus dem HauptRefSys in ein Refsys PlaneX transportieren)
  UT3D_m3_loadpl (m1, pl1);      // trMat m1 zu Plane pl1 generieren
  UT3D_m3_invm3 (mi1, m1);       // inv. trMat zu m1 generieren
  // mi1: obj von einer Plane in Nullage transformieren
  // m1: obj aus Nullage in Refsys m1 (pl1) transportieren
  UTRA_def__ (1, Typ_TraMat, mi1);
  UTRA_app__ (datSpc1, .. Typ_LN, ln2, NULL);



// Example Usage UTRA_app__  (eine struct transformieren)
  char  auxObj[OBJ_SIZ_MAX];
    oSiz = OBJ_SIZ_MAX;
    UME_init (&wrk1Spc, memspc101, sizeof(memspc101));  // translated points
    irc = UTRA_app__ (auxObj, &oSiz, Typ_LN, 1, &ln1, &wrk1Spc);


// Example Usage UTRA_app__  (ein ObjGX-Obj transformieren)
//    zu transformieren ist ObjGX *ox1;
    if(translate == ON) {
      UME_init (&wrk1Spc, memspc101, sizeof(memspc101));  // translated points
      ox2 = (ObjGX*)memspc102;   // ObjGX(Tabelle) out
      oSiz = sizeof(memspc102);
      irc = UTRA_app_obj (ox2, &oSiz, ox1, wrk1Spc);
      if(irc < 0) continue;      // Error
      ox1 = (ObjGX*)memspc102;   // replace pointer 
    }

#include "MS_Def0.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../ut/ut_geo.h"
#include "../ut/ut_TX.h"
#include "../ut/ut_umem.h"
#include "../db/ut_DB.h"
#include "../gr/ut_UI.h"

Defines

#define TRA_TAB_SIZ   10

Functions

int UTRA_app_pt (Point *, Point *)
int UTRA_app_vc (Vector *, Vector *)
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_obj (void *objo, int *oSiz, void *obji, Memspc *wrkSpc)
int UTRA_app_oTab (void *objo, int *oSiz, void *obji, Memspc *wrkSpc)
int UTRA_app_s (long *ind, int *typ, Memspc *wrkSpc)
int UTRA_app__ (void *objo, int *oSiz, int otyp, int iNr, void *obji, Memspc *wrkSpc)
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_m3_iniZrot (TraRot *tr1, Point *ptOri, double ar)
int UTRA_m3_inirot (TraRot *tr1, Point *pa, Vector *va, double ar)
void UTRA_m3_multm3 (Mat_4x3 m3, Mat_4x3 ma, Mat_4x3 mb)

Variables

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


Define 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_def__ ( int  trNr,
int  typ,
void *  data 
)

    UTRA_def__             define transformation
    
    Input:
      trNr    immer mit 1 beginnen; max TRA_TAB_SIZ.
    
    Translation:
      typ=Typ_VC         data=Vector
    Rotation:
      typ=Typ_TraRot     data=TraRot
    Transformation:
      typ=Typ_TraMat     data=Mat_4x3
   
    was UTO_obj_apptra

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_obj_tra UTRA_app_obj

int UTRA_app_obj ( void *  objo,
int *  oSiz,
void *  obji,
Memspc wrkSpc 
)

    apply Tranfsormation to struct or object.
    init Transformation mit UTRA_def__ erforderlich !!!
    Storage:
      Normale structs werden nach objo ausgegeben;
      ObjGX-Records: ObjGX-Records werden nach objo ausgegeben; die
        zugehoerigen Daten (structs) werden in wrkSpc gespeichert.
   
    Input:
      oSiz   size of objo; wird recursiv verkleinert !
      obji   (ObjGX*)  (NUR (ObjGX*) moeglich !)
    Output:
      oSiz   freier Restplatz in objo
      wrkSpc fuer Daten (structs) von oGX-Objekten
    
    see UTO_stru_tra oder UTO_obj_tra

int UTRA_app_oTab ( void *  objo,
int *  oSiz,
void *  obji,
Memspc wrkSpc 
)

    einen oGX-Block resolven
    Input:
      obji parentRecord (ObjGX-Record) dessen form ebenfalls oGX ist
   
    see  DB_store_obj

int UTRA_app_s ( long *  ind,
int *  typ,
Memspc wrkSpc 
)

    copy & transform DB-object typ/ind
    Transformiert objekte die innerhalb einer struct auftreten;
      zB Axis und Konturobjekt in einer SurRev-struct.
    Output:
      ind   DB-index of new obj (dyn.obj!)

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

    apply Tranfsormation to struct; NOT object. 
    init Transformation with UTRA_def__
    Storage:
      Normale structs werden nach objo ausgegeben;
      ObjGX-Records: ObjGX-Records werden nach objo ausgegeben; die
        zugehoerigen Daten (structs) werden in wrkSpc gespeichert.
     
    Input:
      oSiz   size of objo; wird recursiv verkleinert !
      otyp   form of obji; muss also bei Surface auch Typ_ObjGX sein !
      iNr    Anzahl structs to transform
    Output:
      oSiz   freier Restplatz in objo
      wrkSpc fuer Daten (structs) von oGX-Objekten; kann f. structs NULL sein
   
    see UTO_stru_tra oder UTO_obj_tra

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_m3_iniZrot ( TraRot tr1,
Point ptOri,
double  ar 
)

    Drehung um die Z-Achse definieren
    ptOri ist ein Punkt, um den gedreht werden soll.
    Drehung um absolute Z-Achse oder obj schon in NullLage: ptOri=NULL.

int UTRA_m3_inirot ( 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)


Variable Documentation

int TRA_NR = 0 [static]

int TRA_TYP[TRA_TAB_SIZ] [static]

TraRot TRA_TAB[TRA_TAB_SIZ] [static]


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