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 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: GEO Library (C++) 00015 * 00016 * COMMENTS: Rolloff class for proportional modeling 00017 * 00018 */ 00019 00020 #ifndef __GEO_Rolloff_h__ 00021 #define __GEO_Rolloff_h__ 00022 00023 #include "GEO_API.h" 00024 // This must match PRM_Shared::prmSoftTypes in order... 00025 00026 enum GEO_RolloffType { 00027 GEO_ROLLOFF_LINEAR, 00028 GEO_ROLLOFF_QUADRATIC, 00029 GEO_ROLLOFF_SMOOTH, 00030 GEO_ROLLOFF_META 00031 }; 00032 00033 class TS_MetaKernel; 00034 00035 00036 class GEO_API GEO_Rolloff 00037 { 00038 public: 00039 GEO_Rolloff(GEO_RolloffType t = GEO_ROLLOFF_SMOOTH, 00040 float r = 1.0f, bool c = true, 00041 float tdeg0 = 0.0f, float tdeg1 = 0.0f, 00042 TS_MetaKernel *kernel = 0); 00043 00044 // Not all rolloff functions require a fsqrted distance, so 00045 // avoid it if necessary. 00046 float apply(float dist2, bool normalize = true) const; 00047 00048 void radius(float r) { 00049 myRadius = (r >= 0.0f ? r : 0.0f); 00050 myRadius2 = myRadius * myRadius; 00051 } 00052 float radius(void) const { return myRadius; } 00053 float radius2(void) const { return myRadius2; } 00054 00055 void connected(bool c) { myConnected = c; } 00056 bool connected(void) const { return myConnected; } 00057 00058 void type(GEO_RolloffType t) { myType = t; } 00059 00060 00061 private: 00062 GEO_RolloffType myType; 00063 float myRadius; // normalized 00064 float myRadius2; // myRadius squared cached for speed 00065 bool myConnected; 00066 00067 float myTanRad0; // Angle of tangent slope 00068 float myTanRad1; 00069 TS_MetaKernel *myKernel; // My meta kernel 00070 }; 00071 00072 #endif
1.5.9