00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Cristin Barghiel 00008 * Side Effects Software Inc. 00009 * 20 Maud St. 00010 * Toronto, Ontario, M5V 2M5 00011 * Canada 00012 * 416-366-4607 00013 * 00014 * NAME: Geometry Library (C++) 00015 * 00016 * COMMENTS: 00017 * This class implements a Greville abscissa, which is an average 00018 * of "order" knots in parametric space. 00019 * 00020 */ 00021 00022 #ifndef __GEO_Greville_h__ 00023 #define __GEO_Greville_h__ 00024 00025 #include "GEO_API.h" 00026 #include <UT/UT_Vector4.h> 00027 00028 class GEO_API GEO_Greville { 00029 public: 00030 // Trivial constructor that sets all the private data to 0. Needed when 00031 // instantiating arrays of Greville objects. 00032 GEO_Greville() : uVal((float)0.), vVal((float)0.) 00033 { 00034 image.assign(0.0F, 0.0F, 0.0F, 1.0F); 00035 } 00036 00037 // Constructor that takes the (u,v) or (u) position of the Greville abscissa 00038 // in parametric space, and its image on the surface. Later, the image 00039 // info might represent the CV displacement. img is copied memberwise. 00040 GEO_Greville(const UT_Vector4 &img, float u = 0.0f, float v = 0.0f) 00041 { 00042 uVal = u; vVal = v; 00043 image = img; 00044 } 00045 00046 // Class destructor. Does nothing. 00047 ~GEO_Greville() {} 00048 00049 // Set either image: in domain space or in surface (CV) space 00050 // respectively. img is copied memberwise. 00051 void setUVImage(float u) { uVal = u; } 00052 void setUVImage(float u, float v) { uVal = u; vVal = v; } 00053 void setCVImage(const UT_Vector4& img) { image = img; } 00054 00055 // Grab the private info. 00056 void getUVImage(float *u) const { *u = uVal; } 00057 void getUVImage(float *u, float *v) const 00058 { 00059 *u = uVal; *v = vVal; 00060 } 00061 const UT_Vector4& getCVImage(void) const { return image; } 00062 00063 // Deeply copy the data of the source. 00064 GEO_Greville& operator=(const GEO_Greville &src) 00065 { 00066 if (this != &src) 00067 { 00068 uVal = src.uVal; vVal = src.vVal; 00069 image = src.image; 00070 } 00071 return *this; 00072 } 00073 00074 // Compare two Greville points: 00075 int operator==(const GEO_Greville &grev) const 00076 { 00077 return (uVal == grev.uVal && vVal == grev.vVal && 00078 image == grev.image); 00079 } 00080 00081 protected: 00082 private: 00083 // The (u,v) position in domain space, and the image on the surface. 00084 float uVal; 00085 float vVal; 00086 UT_Vector4 image; 00087 }; 00088 00089 #endif
1.5.9