Commit cbdd851b authored by Will Schroeder's avatar Will Schroeder
Browse files

*** empty log message ***

parent 4f29a02c
......@@ -35,7 +35,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#define vlSetMacro(name,type) \
void Set##name (type _arg) \
{ \
if (Debug) cerr << GetClassName() << " " << this << ", setting " << #name " to " << _arg << "\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to " << _arg << "\n\n"; \
if (name != _arg) \
{ \
name = _arg; \
......@@ -48,7 +48,7 @@ void Set##name (type _arg) \
//
#define vlGetMacro(name,type) \
type Get##name () { \
if (Debug) cerr << GetClassName() << " " << this << ", returning " << #name " of " << name << "\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): returning " << #name " of " << name << "\n\n"; \
return name; \
}
......@@ -59,7 +59,7 @@ type Get##name () { \
#define vlSetStringMacro(name) \
void Set##name (char* _arg) \
{ \
if (Debug) cerr << GetClassName() << " " << this << ", setting " << #name " to " << _arg << "\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to " << _arg << "\n\n"; \
if ( name && _arg ) \
if ( !strcmp(name,_arg) ) return; \
if (name) delete [] name; \
......@@ -81,7 +81,7 @@ void Set##name (char* _arg) \
//
#define vlGetStringMacro(name) \
char* Get##name () { \
if (Debug) cerr << GetClassName() << " " << this << ", returning " << #name " of " << name << "\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): returning " << #name " of " << name << "\n\n"; \
return name; \
}
......@@ -95,7 +95,7 @@ char* Get##name () { \
#define vlSetClampMacro(name,type,min,max) \
void Set##name (type _arg) \
{ \
if (Debug) cerr << GetClassName() << " " << this << ", setting " << #name " to " << _arg << "\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to " << _arg << "\n\n"; \
if (name != _arg) \
{ \
name = (_arg<min?min:(_arg>max?max:_arg)); \
......@@ -110,7 +110,7 @@ void Set##name (type _arg) \
#define vlSetObjectMacro(name,type) \
void Set##name (type* _arg) \
{ \
if (Debug) cerr << GetClassName() << " " << this << ", setting " << #name " to " << &_arg << "\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to " << &_arg << "\n\n"; \
if (name != _arg) \
{ \
if (name != 0) name->UnRegister((void *)this); \
......@@ -126,7 +126,7 @@ void Set##name (type* _arg) \
#define vlGetObjectMacro(name,type) \
type *Get##name () \
{ \
if (Debug) cerr << GetClassName() << " " << this << ", returning " << #name " address " << name << "\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): returning " << #name " address " << name << "\n\n"; \
return name; \
}
......@@ -147,7 +147,7 @@ void name##Off () { Set##name((type)0);}
#define vlSetVector2Macro(name,type) \
void Set##name (type _arg1, type _arg2) \
{ \
if (Debug) cerr << GetClassName() << " " << this << ", setting " << #name " to (" << _arg1 << "," << _arg2 << ")\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to (" << _arg1 << "," << _arg2 << ")\n\n"; \
if ((name[0] != _arg1)||(name[1] != _arg2)) \
{ \
Modified(); \
......@@ -157,7 +157,7 @@ void Set##name (type _arg1, type _arg2) \
}; \
void Set##name (type _arg[2]) \
{ \
if (Debug) cerr << GetClassName() << " " << this << ", setting " << #name " to (" << _arg[0] << "," << _arg[1] << ")\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to (" << _arg[0] << "," << _arg[1] << ")\n\n"; \
if ((name[0] != _arg[0])||(name[1] != _arg[1])) \
{ \
Modified(); \
......@@ -169,7 +169,7 @@ void Set##name (type _arg[2]) \
#define vlSetVector3Macro(name,type) \
void Set##name (type _arg1, type _arg2, type _arg3) \
{ \
if (Debug) cerr << GetClassName() << " " << this << ", setting " << #name " to (" << _arg1 << "," << _arg2 << "," << _arg3 << ")\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to (" << _arg1 << "," << _arg2 << "," << _arg3 << ")\n\n"; \
if ((name[0] != _arg1)||(name[1] != _arg2)||(name[2] != _arg3)) \
{ \
Modified(); \
......@@ -180,7 +180,7 @@ void Set##name (type _arg1, type _arg2, type _arg3) \
}; \
void Set##name (type _arg[3]) \
{ \
if (Debug) cerr << GetClassName() << " " << this << ", setting " << #name " to (" << _arg[0] << "," << _arg[1] << "," << _arg[2] << ")\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to (" << _arg[0] << "," << _arg[1] << "," << _arg[2] << ")\n\n"; \
if ((name[0] != _arg[0])||(name[1] != _arg[1])||(name[2] != _arg[2])) \
{ \
Modified(); \
......@@ -193,7 +193,7 @@ void Set##name (type _arg[3]) \
#define vlSetVector4Macro(name,type) \
void Set##name (type _arg1, type _arg2, type _arg3, type _arg4) \
{ \
if (Debug) cerr << GetClassName() << " " << this << ", setting " << #name " to (" << _arg1 << "," << _arg2 << "," << _arg3 << "," << _arg4 << ")\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to (" << _arg1 << "," << _arg2 << "," << _arg3 << "," << _arg4 << ")\n\n"; \
if ((name[0] != _arg1)||(name[1] != _arg2)||(name[2] != _arg3)||(name[3] != _arg4)) \
{ \
Modified(); \
......@@ -205,7 +205,7 @@ void Set##name (type _arg1, type _arg2, type _arg3, type _arg4) \
}; \
void Set##name (type _arg[4]) \
{ \
if (Debug) cerr << GetClassName() << " " << this << ", setting " << #name " to (" << _arg[0] << "," << _arg[1] << "," << _arg[2] << "," << _arg[3] << ")\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): setting " << #name " to (" << _arg[0] << "," << _arg[1] << "," << _arg[2] << "," << _arg[3] << ")\n\n"; \
if ((name[0] != _arg[0])||(name[1] != _arg[1])||(name[2] != _arg[2])||(name[3] != _arg[3])) \
{ \
Modified(); \
......@@ -222,22 +222,22 @@ void Set##name (type _arg[4]) \
//
#define vlGetVectorMacro(name,type) \
type *Get##name () { \
if (Debug) cerr << GetClassName() << " " << this << ", returning " << #name " pointer " << name << "\n"; \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): returning " << #name " pointer " << name << "\n\n"; \
return name; \
}
//
// This macro is used for debug statements in instance methods
// vlDebugMacro(<< "this is debug info" << this->SomeVariable << "\n");
// vlDebugMacro(<< "this is debug info" << this->SomeVariable);
//
#define vlDebugMacro(x) \
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << ": " x
if (Debug) cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): " x << "\n\n"
//
// This macro is used to print out errors
// vlErrorMacro(<< "Error message" << variable << "\n");
// vlErrorMacro(<< "Error message" << variable);
//
#define vlErrorMacro(x) \
cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << ": " x
cerr << "In " __FILE__ << ", line " << __LINE__ << "\n" << this->GetClassName() << " (" << this << "): " x << "\n\n"
#endif
......@@ -24,20 +24,39 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
class vlMath
{
public:
vlMath();
vlMath() {};
float Pi() {return 3.14159265358979;};
float DegreesToRadians() {return 0.018977369;};
float Dot(float x[3], float y[3])
{return x[0]*y[0] + x[1]*y[1] + x[2]*y[2];};
void Cross(float x[3], float y[3], float z[3])
{z[0] = x[1]*y[2] - x[2]*y[1];
z[1] = x[2]*y[0] - x[0]*y[2];
z[2] = x[0]*y[1] - x[1]*y[0];};
float Norm(float x[3])
{return sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);};
float Determinate3x3(float *c1, float *c2, float *c3)
{return c1[0]*c2[1]*c3[2] + c2[0]*c3[1]*c1[2] + c3[0]*c1[1]*c2[2] -
c1[0]*c3[1]*c2[2] - c2[0]*c1[1]*c3[2] - c3[0]*c2[1]*c1[2];};
float Determinate2x2(float *c1, float *c2)
{return c1[0]*c2[1] - c2[0]*c1[1];};
float Distance2BetweenPoints(float *x, float *y)
{return (x[0]-y[0])*(x[0]-y[0]) + (x[1]-y[1])*(x[1]-y[1]) +
(x[2]-y[2])*(x[2]-y[2]);};
void RandomSeed(long s);
float Random();
private:
float Random(float min, float max) {return min+Random()*(max-min);};
protected:
static long Seed;
};
......
......@@ -34,21 +34,21 @@ vlObject::~vlObject()
{
if (this->RefCount > 0)
{
vlErrorMacro(<<": Trying to delete object with non-zero refCount\n\n");
vlErrorMacro(<< "Trying to delete object with non-zero refCount");
}
vlDebugMacro(<< this <<", Destructing!\n\n");
vlDebugMacro(<< "Destructing!");
}
void vlObject::Register(void *p)
{
this->RefCount++;
vlDebugMacro(<< this << ", Registered by " << (void *)p << "\n\n");
vlDebugMacro(<< "Registered by " << (void *)p);
}
void vlObject::UnRegister(void *p)
{
vlDebugMacro(<< this << ", UnRegistered by " << (void *)p << "\n\n");
vlDebugMacro(<< "UnRegistered by " << (void *)p);
if (--this->RefCount <= 0) delete this;
}
......
......@@ -20,10 +20,6 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
long vlMath::Seed = 1177; // One authors home address
vlMath::vlMath()
{
}
//
// Generate random numbers between 0.0 and 1.0
// This is used to provide portability across different systems.
......@@ -56,7 +52,6 @@ float vlMath::Random()
Seed += K_M;
return ((float) this->Seed / K_M);
}
//
// initialize seed value
// NOTE: Random() has the bad property that the first random
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment