Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

cgul.cpp File Reference

#include "stdafx.h"
#include <iostream>
#include "gul_types.h"
#include "gunu_mba_approximate.h"
#include "guma_transform.h"

Go to the source code of this file.

Compounds

struct  GULpoint
struct  GULpoint2

Defines

#define GULDECL
#define GULCALL
#define CCALL

Functions

void set (double *out, const double &in)
void set (point< double > *out, const GULpoint &in)
void set (point2< double > *out, const GULpoint2 &in)
void set (GULpoint *out, const point< double > &in)
void set (GULpoint2 *out, const point2< double > &in)
template<class T1, class T2> void copy (int n, const T1 *inP, Ptr< T2 > &outP)
template<class T1, class T2> void copy (int n, const Ptr< T1 > &inP, T2 **outP)
template<class T1, class T2> void copy (int m, int n, const T1 **inP, Ptr< Ptr< T2 > > &outP)
template<class T1, class T2> void copy (int m, int n, const Ptr< Ptr< T1 > > &inP, T2 ***outP)
GULDECL void GULCALL GUL_set_malloc_func (void *(CCALL *func)(size_t))
GULDECL void GULCALL GUL_set_free_func (void(CCALL *func)(void *))
void * galloc (size_t size)
void gree (void *p)
GULDECL void GULCALL GUL_SurfaceOverXYPlane (int nDatPoints, GULpoint *datPoints, int useStdDevs, double *StdDevs, int minimize, int nIter, int pu, int pv, int *ret_nu, double **retU, int *ret_nv, double **retV, GULpoint ***retPw)
 executes the MBA algorithm and constructs a 3-dimensional surface from the results (x,y are linear mappings of u and v ). More...

GULDECL void GULCALL GUL_MBASurface (int nDatPoints, GULpoint *datPoints, GULpoint2 *domPoints, int nIter, int pu, int pv, int *ret_nu, double **retU, int *ret_nv, double **retV, GULpoint ***retPw)
 creates a surface with the MBA algorithm. More...

GULDECL void GULCALL GUL_CommonCoordinateSystem (GULpoint B, GULpoint P, GULpoint Ab, GULpoint Pb, double **T)


Define Documentation

#define CCALL
 

Definition at line 35 of file cgul.cpp.

Referenced by copy(), GUL_set_free_func(), and GUL_set_malloc_func().

#define GULCALL
 

Definition at line 34 of file cgul.cpp.

Referenced by GUL_CommonCoordinateSystem(), GUL_MBASurface(), GUL_set_free_func(), GUL_set_malloc_func(), and GUL_SurfaceOverXYPlane().

#define GULDECL
 

Definition at line 33 of file cgul.cpp.

Referenced by GUL_CommonCoordinateSystem(), GUL_MBASurface(), GUL_set_free_func(), GUL_set_malloc_func(), and GUL_SurfaceOverXYPlane().


Function Documentation

template<class T1, class T2>
void copy int    m,
int    n,
const Ptr< Ptr< T1 > > &    inP,
T2 ***    outP
 

Definition at line 133 of file cgul.cpp.

References CCALL, galloc(), and set().

Referenced by GUL_MBASurface(), and GUL_SurfaceOverXYPlane().

00134 {
00135   int i,j;
00136   *outP = (T2**)galloc( sizeof(T2*) * m );
00137   for( i = 0; i < m; i++ )
00138   {
00139     (*outP)[i] = (T2*)galloc( sizeof(T2) * n );
00140     for( j = 0; j < n; j++ )
00141       set( &(*outP)[i][j], inP[i][j] );
00142   }
00143 }

template<class T1, class T2>
void copy int    m,
int    n,
const T1 **    inP,
Ptr< Ptr< T2 > > &    outP
 

Definition at line 120 of file cgul.cpp.

References set().

00121 {
00122   int i;
00123   outP.reserve_pool(m);
00124   for( i = 0; i < m; i++ )
00125   {
00126     outP[i].reserve_pool(n);
00127     for( j = 0; j < n; j++ )
00128       set( &outP[i][j], inP[i][j] );
00129   }
00130 }

template<class T1, class T2>
void copy int    n,
const Ptr< T1 > &    inP,
T2 **    outP
 

Definition at line 109 of file cgul.cpp.

References galloc(), and set().

00110 {
00111   int i;
00112   *outP = (T2 *)galloc( sizeof(T2) * n );
00113   for( i = 0; i < n; i++ )
00114     set( &(*outP)[i], inP[i] );
00115 }

template<class T1, class T2>
void copy int    n,
const T1 *    inP,
Ptr< T2 > &    outP
 

Definition at line 100 of file cgul.cpp.

References set().

00101 {
00102   int i;
00103   outP.reserve_pool(n);
00104   for( i = 0; i < n; i++ )
00105     set( &outP[i], inP[i] );
00106 }

void* galloc size_t    size
 

Definition at line 170 of file cgul.cpp.

Referenced by copy().

00171 {
00172   if( GUL_malloc_func )
00173     return GUL_malloc_func(size);
00174 
00175   return malloc(size);
00176 }

void gree void *    p
 

Definition at line 178 of file cgul.cpp.

00179 {
00180   if( GUL_free_func )
00181   {
00182     GUL_free_func(p);
00183     return;
00184   }
00185   free(p);
00186 }

GULDECL void GULCALL GUL_CommonCoordinateSystem GULpoint    B,
GULpoint    P,
GULpoint    Ab,
GULpoint    Pb,
double **    T
 

Definition at line 274 of file cgul.cpp.

References guma::CommonCoordinateSystem(), GULCALL, GULDECL, GULpoint::x, GULpoint::y, and GULpoint::z.

00277 {
00278   point<double> b,p,ab,pb;
00279   Ptr< Ptr<double> > t;
00280   int i,j;
00281 
00282   b.x = B.x;    b.y = B.y;    b.z = B.z;
00283   p.x = P.x;    p.y = P.y;    p.z = P.z;
00284   ab.x = Pb.x;    ab.y = Pb.y;    ab.z = Pb.z;
00285   pb.x = Pb.x;    pb.y = Pb.y;    pb.z = Pb.z;
00286 
00287   t.reserve_pool(4);
00288   for( i = 0; i < 4; i++ )
00289     t[i].reserve_pool(4);
00290 
00291   guma::CommonCoordinateSystem( b, p, ab, pb, t );
00292 
00293   for( i = 0; i < 4; i++ )
00294     for( j = 0; j < 4; j++ )
00295       T[i][j] = t[i][j];
00296 }

GULDECL void GULCALL GUL_MBASurface int    nDatPoints,
GULpoint   datPoints,
GULpoint2   domPoints,
int    nIter,
int    pu,
int    pv,
int *    ret_nu,
double **    retU,
int *    ret_nv,
double **    retV,
GULpoint ***    retPw
 

creates a surface with the MBA algorithm.

'Dat' contains the 3d values and 'Dom' the locations in the parametric domain (output arrays are reserved automatically)

Definition at line 240 of file cgul.cpp.

References copy(), GULCALL, GULDECL, and gunu::MBASurface().

00246 {
00247   Ptr< point<double> > dat;
00248   Ptr< point2<double> > dom;
00249   Ptr<double> U,V;
00250   Ptr< Ptr< point<double> > > Pw;
00251 
00252   copy( nDatPoints, datPoints, dat );
00253   copy( nDatPoints, domPoints, dom );
00254 
00255   gunu::MBASurface( nDatPoints, dat, dom, nIter, pu, pv, 
00256                     ret_nu, &U, ret_nv, &V, &Pw );
00257 
00258   copy( U.nElems(), U, retU ); 
00259   copy( V.nElems(), V, retV ); 
00260   copy( Pw.nElems(), Pw[0].nElems(), Pw, retPw );
00261 }

GULDECL void GULCALL GUL_set_free_func void(CCALL *func   )(void *)
 

Definition at line 165 of file cgul.cpp.

References CCALL, GULCALL, and GULDECL.

00166 {
00167   GUL_free_func = func;
00168 }

GULDECL void GULCALL GUL_set_malloc_func void *(CCALL *func   )(size_t)
 

Definition at line 160 of file cgul.cpp.

References CCALL, GULCALL, and GULDECL.

00161 {
00162   GUL_malloc_func = func;
00163 }

GULDECL void GULCALL GUL_SurfaceOverXYPlane int    nDatPoints,
GULpoint   datPoints,
int    useStdDevs,
double *    StdDevs,
int    minimize,
int    nIter,
int    pu,
int    pv,
int *    ret_nu,
double **    retU,
int *    ret_nv,
double **    retV,
GULpoint ***    retPw
 

executes the MBA algorithm and constructs a 3-dimensional surface from the results (x,y are linear mappings of u and v ).

when 'minimize' is set, the base rectangle in the xy-plane is chosen so that its area is minimal

input arrays:

datPoints : array of data-points StdDevs : standard deviations of the data points (if useStdDevs = 0, all assumed as beeing one)

output arrays are reserved by the function and have the dimensions:

retU : nu + pu + 2 retV : nv + pv + 2 retPw : nv + 1 retPw[i] : nu + 1

Definition at line 209 of file cgul.cpp.

References copy(), GULCALL, and GULDECL.

00217 {
00218   Ptr< point<double> > datP;
00219   Ptr<double> stdD, U, V;
00220   Ptr< Ptr< point<double> > > Pw;
00221 
00222   copy( nDatPoints, datPoints, datP );
00223   if( useStdDevs ) copy( nDatPoints, StdDevs, stdD );
00224 
00225   gunu::SurfaceOverXYPlane< double,point<double> >( 
00226                nDatPoints, datP, (useStdDevs!=0), stdD, (minimize!=0), nIter, pu, pv, 
00227                ret_nu, &U, ret_nv, &V, &Pw );
00228 
00229   copy( U.nElems(), U, retU ); 
00230   copy( V.nElems(), V, retV ); 
00231   copy( Pw.nElems(), Pw[0].nElems(), Pw, retPw );
00232 }

void set GULpoint2   out,
const point2< double > &    in
[inline]
 

Definition at line 91 of file cgul.cpp.

References GULpoint2::x, and GULpoint2::y.

Referenced by copy().

00092 {
00093   out->x = in.x;
00094   out->y = in.y;
00095 }  

void set GULpoint   out,
const point< double > &    in
[inline]
 

Definition at line 84 of file cgul.cpp.

References GULpoint::x, GULpoint::y, and GULpoint::z.

00085 {
00086   out->x = in.x;
00087   out->y = in.y;
00088   out->z = in.z;
00089 }  

void set point2< double > *    out,
const GULpoint2   in
[inline]
 

Definition at line 78 of file cgul.cpp.

References GULpoint2::x, and GULpoint2::y.

00079 {
00080   out->x = in.x;
00081   out->y = in.y;
00082 }

void set point< double > *    out,
const GULpoint   in
[inline]
 

Definition at line 71 of file cgul.cpp.

References GULpoint::x, GULpoint::y, and GULpoint::z.

00072 {
00073   out->x = in.x;
00074   out->y = in.y;
00075   out->z = in.z;
00076 }  

void set double *    out,
const double &    in
[inline]
 

Definition at line 66 of file cgul.cpp.

00067 {
00068   *out = in;
00069 } 


Generated on Mon Jan 21 04:17:45 2002 for GUL 0.6 - Geometry Utility Library by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001