Vertices.c File Reference

#include "Vertices.h"
#include "MALLOC.h"
#include "GetProperty.h"
#include "GraphicZoom.h"
#include "sciprint.h"

Include dependency graph for Vertices.c:

Go to the source code of this file.

Functions

int getVertexIndex (void)
void setVertexIndex (int ind)
int SetMinMaxVertices (Vertices *vertices_list, double *xmin, double *ymin, double *zmin, double *xmax, double *ymax, double *zmax)
int GetVerticesAt (Vertices *vertices_list, int *xm, int *ym, double *x, double *y, double *z)
int RemoveNext (Vertices *pCurrent)
int FreeVertices (sciPointObj *psubwin)
int Store3DPixelValues (sciPointObj *pobj, int xm, int ym, double x, double y, double z)

Variables

static int vertex_index = 0
static VerticespHead = NULL
static VerticespHead2 = NULL


Function Documentation

int FreeVertices ( sciPointObj psubwin  ) 

Definition at line 82 of file Vertices.c.

References FREE, NULL, pHead, pHead2, _Vertices::pNext, pSUBWIN_FEATURE, RemoveNext(), and sciSubWindow::vertices_list.

Referenced by zoom_box().

00083 {
00084   sciSubWindow * ppsubwin = pSUBWIN_FEATURE(psubwin);
00085   Vertices * pCurrent = ppsubwin->vertices_list;
00086 
00087   if (pCurrent != NULL) {
00088 
00089     /*pCurrent = Tete; */
00090     while (pCurrent->pNext != NULL){
00091       RemoveNext(pCurrent);
00092     }
00093     FREE(ppsubwin->vertices_list); ppsubwin->vertices_list = (Vertices *) NULL;
00094   }
00095 
00096   pHead = (Vertices *) NULL;
00097   pHead2 = (Vertices *) NULL;
00098 
00099   return 0;
00100 }

Here is the call graph for this function:

Here is the caller graph for this function:

int getVertexIndex ( void   ) 

Definition at line 19 of file Vertices.c.

References vertex_index.

Referenced by zoom_box().

00020 {
00021   return vertex_index ;
00022 }

Here is the caller graph for this function:

int GetVerticesAt ( Vertices vertices_list,
int xm,
int ym,
double *  x,
double *  y,
double *  z 
)

Definition at line 52 of file Vertices.c.

References NULL, pHead2, _Vertices::pNext, _Vertices::value_x, _Vertices::value_xm, _Vertices::value_y, _Vertices::value_ym, and _Vertices::value_z.

Referenced by zoom_box().

00053 {
00054   Vertices * pCurrent = vertices_list;
00055 
00056   if(pHead2 == (Vertices *) NULL)
00057     pHead2 = pCurrent;
00058 
00059   *xm = pHead2->value_xm;
00060   *ym = pHead2->value_ym;
00061   *x  = pHead2->value_x;
00062   *y  = pHead2->value_y;
00063   *z  = pHead2->value_z;
00064 
00065   pHead2 = pHead2->pNext;
00066 
00067   return 0;
00068 }

Here is the caller graph for this function:

int RemoveNext ( Vertices pCurrent  ) 

Definition at line 70 of file Vertices.c.

References FREE, NULL, and _Vertices::pNext.

Referenced by FreeVertices().

00071 {
00072   Vertices * DeletedElement = pCurrent->pNext;
00073   Vertices * pNextNext =  pCurrent->pNext->pNext;
00074 
00075   FREE(DeletedElement); DeletedElement = (Vertices *) NULL;
00076 
00077   pCurrent->pNext = pNextNext;
00078 
00079   return 0;
00080 }

Here is the caller graph for this function:

int SetMinMaxVertices ( Vertices vertices_list,
double *  xmin,
double *  ymin,
double *  zmin,
double *  xmax,
double *  ymax,
double *  zmax 
)

Definition at line 29 of file Vertices.c.

References NULL, _Vertices::pNext, _Vertices::value_x, _Vertices::value_y, and _Vertices::value_z.

Referenced by zoom_box().

00030 { 
00031   Vertices * pCurrent = vertices_list;
00032 
00033   *xmin = *xmax = vertices_list->value_x;
00034   *ymin = *ymax = vertices_list->value_y;
00035   *zmin = *zmax = vertices_list->value_z;
00036 
00037   while (pCurrent != NULL) {
00038     if(pCurrent->value_x >  *xmin) *xmin = pCurrent->value_x;
00039     if(pCurrent->value_y >  *ymin) *ymin = pCurrent->value_y;
00040     if(pCurrent->value_z >  *zmin) *zmin = pCurrent->value_z;
00041 
00042     if(pCurrent->value_x <  *xmax) *xmax = pCurrent->value_x;
00043     if(pCurrent->value_y <  *ymax) *ymax = pCurrent->value_y;
00044     if(pCurrent->value_z <  *zmax) *zmax = pCurrent->value_z;
00045 
00046     pCurrent = pCurrent->pNext;
00047   }
00048 
00049   return 0;
00050 }

Here is the caller graph for this function:

void setVertexIndex ( int  ind  ) 

Definition at line 24 of file Vertices.c.

References vertex_index.

Referenced by zoom_box().

00025 {
00026   vertex_index = ind ;
00027 }

Here is the caller graph for this function:

int Store3DPixelValues ( sciPointObj pobj,
int  xm,
int  ym,
double  x,
double  y,
double  z 
)

Definition at line 104 of file Vertices.c.

References isZoom3dOn(), MALLOC, NULL, pHead, _Vertices::pNext, pSUBWIN_FEATURE, sciGetParentSubwin(), sciprint(), _Vertices::value_x, _Vertices::value_xm, _Vertices::value_y, _Vertices::value_ym, _Vertices::value_z, vertex_index, and sciSubWindow::vertices_list.

Referenced by trans3d().

00105 {
00106 
00107   sciPointObj * psubwin = sciGetParentSubwin(pobj);
00108   sciSubWindow *ppsubwin = pSUBWIN_FEATURE(psubwin);
00109 
00110   if( isZoom3dOn() )
00111   {
00112     Vertices * pCurrent = ppsubwin->vertices_list;
00113 
00114     if (pCurrent != NULL) {
00115 
00116       pCurrent = pHead;
00117 
00118       if(( pCurrent->pNext = (Vertices*) MALLOC(sizeof(Vertices))) == NULL){
00119         sciprint("Allocation failed for vertices when zoom called.\n");
00120         return -1;
00121       }
00122 
00123       pCurrent->pNext->pNext = NULL;
00124 
00125       pCurrent->pNext->value_xm = xm;
00126       pCurrent->pNext->value_ym = ym;
00127       pCurrent->pNext->value_x = x;
00128       pCurrent->pNext->value_y = y;
00129       pCurrent->pNext->value_z = z;
00130 
00131       pHead = pCurrent->pNext;
00132 
00133     }
00134     else
00135     { /* first element is created */
00136       if((ppsubwin->vertices_list = (Vertices*) MALLOC(sizeof(Vertices))) == NULL){
00137         sciprint("Allocation failed for vertices when zoom called\n");
00138         return -1;
00139       }
00140 
00141       ppsubwin->vertices_list->value_xm = xm;
00142       ppsubwin->vertices_list->value_ym = ym;
00143       ppsubwin->vertices_list->value_x = x;
00144       ppsubwin->vertices_list->value_y = y;
00145       ppsubwin->vertices_list->value_z = z;
00146 
00147       ppsubwin->vertices_list->pNext = NULL;
00148 
00149       pHead = ppsubwin->vertices_list;
00150 
00151     }
00152     vertex_index++;
00153   }
00154 
00155   return 0;
00156 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Vertices* pHead = NULL [static]

Definition at line 15 of file Vertices.c.

Referenced by FreeVertices(), and Store3DPixelValues().

Vertices* pHead2 = NULL [static]

Definition at line 16 of file Vertices.c.

Referenced by FreeVertices(), and GetVerticesAt().

int vertex_index = 0 [static]

Definition at line 14 of file Vertices.c.

Referenced by getVertexIndex(), setVertexIndex(), and Store3DPixelValues().


Generated on Sun Mar 4 15:55:12 2007 for Scilab [trunk] by  doxygen 1.5.1