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 * Jonathan McGee 00008 * Side Effects 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: Geometry library (C++) 00015 * 00016 * COMMENTS: Simple cache for distances between geometry elements 00017 * during soft transforms. These structures are in essense 00018 * groups which are not attached to the gdp. Along with 00019 * each soft element of the group, we have a float value which 00020 * stores the squared distance to the nearest hard element. 00021 * 00022 * Thus with this cache we are able to store soft squared 00023 * distances, and implicitly store connectivity information. 00024 * Simply, if an element is not contained in the cache, 00025 * it will not be affected by the soft operation. 00026 */ 00027 00028 #ifndef __GU_SoftTransformCache_H__ 00029 #define __GU_SoftTransformCache_H__ 00030 00031 #include "GEO_API.h" 00032 #include <UT/UT_PtrArray.h> 00033 #include <UT/UT_IntArray.h> 00034 #include <UT/UT_FloatArray.h> 00035 00036 class GEO_Point; 00037 class GEO_Primitive; 00038 00039 class GEO_API GEO_SoftTransformPointCache 00040 { 00041 public: 00042 GEO_SoftTransformPointCache(); 00043 ~GEO_SoftTransformPointCache(); 00044 00045 void appendHardPt(GEO_Point *pt); 00046 void appendSoftPt(GEO_Point *pt, float dist2); 00047 00048 GEO_Point *getHardPt(int i) const; 00049 00050 GEO_Point *getSoftPt(int i) const; 00051 float getSoftDist2(int i) const; 00052 00053 // Number of hard points 00054 int hardEntries() const; 00055 // Number of soft points 00056 int softEntries() const; 00057 00058 void clearCache(); 00059 00060 private: 00061 UT_PtrArray<GEO_Point*> myHardPtrArray; 00062 UT_PtrArray<GEO_Point*> mySoftPtrArray; 00063 UT_FloatArray mySoftDistArray; 00064 }; 00065 00066 class GEO_API GEO_SoftTransformVertexCache 00067 { 00068 public: 00069 GEO_SoftTransformVertexCache(); 00070 ~GEO_SoftTransformVertexCache(); 00071 00072 void appendHardVtx(GEO_Primitive *prim, int index); 00073 void appendSoftVtx(GEO_Primitive *prim, int index, 00074 float dist2); 00075 00076 GEO_Primitive *getHardPrim(int i) const; 00077 int getHardIndex(int i) const; 00078 00079 GEO_Primitive *getSoftPrim(int i) const; 00080 int getSoftIndex(int i) const; 00081 float getSoftDist2(int i) const; 00082 00083 // Number of hard vertices 00084 int hardEntries() const; 00085 // Number of soft vertices 00086 int softEntries() const; 00087 00088 void clearCache(); 00089 00090 // Access the soft arrays 00091 UT_PtrArray<GEO_Primitive*>& softPtrArray() { return mySoftPtrArray; } 00092 UT_IntArray& softIndexArray() { return mySoftIndexArray; } 00093 UT_FloatArray& softDistArray() { return mySoftDistArray; } 00094 00095 private: 00096 UT_PtrArray<GEO_Primitive*> myHardPtrArray; 00097 UT_IntArray myHardIndexArray; 00098 UT_PtrArray<GEO_Primitive*> mySoftPtrArray; 00099 UT_IntArray mySoftIndexArray; 00100 UT_FloatArray mySoftDistArray; 00101 }; 00102 00103 #endif
1.5.9