using namespace HDK_Sample;
PRM_Name(
"dampingk",
"Damping Constant"),
PRM_Name(
"condfromchan",
"Initial Conditions From Channel"),
PRM_Name(
"initpos",
"Initial Position"),
};
};
springMethodItems);
{
&springConstantRange),
&massRange),
&dampingConstantRange),
&springMethodMenu),
&initDispRange),
&initVelRange),
};
bool
{
bool grab = GRAB_INITIAL();
return changes;
}
enum
{
};
{ 0, 0, 0 }
};
bool
{
switch(index)
{
myChannelDependent=1;
return true;
return true;
}
}
{
}
{
mySteady = 0;
}
CHOP_Spring::~CHOP_Spring()
{
}
{
int force_method;
int i,
j,
length, num_tracks, animated_parms;
int stop;
bool grab_init = GRAB_INITIAL();
if (!clip)
force_method = METHOD();
my_C= 0;
myChannelDependent=0;
spring_constant = SPRING_CONSTANT(context.
getTime());
damping_constant = DAMPING_CONSTANT(context.
getTime());
animated_parms = myChannelDependent;
if(!grab_init)
{
initial_displacement = INITIAL_DISPLACEMENT(context.
getTime());
initial_velocity = INITIAL_VELOCITY(context.
getTime());
}
if (mass < 0.001)
{
mass = 0.001;
}
stop = 0;
if(boss->
opStart(
"Calculating Spring"))
{
if (clip)
{
for (i=0; i<num_tracks; i++)
{
my_C = i;
{
*new_track = *track;
continue;
}
if(grab_init || animated_parms)
{
if(animated_parms)
{
spring_constant = SPRING_CONSTANT(context.
getTime());
if (mass < 0.001)
mass = 0.001;
damping_constant = DAMPING_CONSTANT(context.
getTime());
}
if(grab_init)
{
initial_displacement);
}
}
d1 = initial_displacement;
d2 = d1 - initial_velocity * inc;
{
{
stop = 1;
break;
}
if(!force_method)
f *= spring_constant;
vel = (d1-d2) / inc;
acc = (f - vel*damping_constant - d1*spring_constant)/mass;
vel += acc * inc;
d = d1 + vel * inc;
d2 = d1;
d1 = d;
}
{
stop = 1;
break;
}
}
}
}
}
namespace HDK_Sample {
{
public:
};
}
myDn1(d1),
myDn2(d2)
{
}
bool
{
return false;
return false;
return false;
return true;
}
bool
{
return true;
}
int
{
return mySteady;
}
{
int force_method;
int animated_parms;
force_method = METHOD();
my_C= 0;
myChannelDependent=0;
spring_constant = SPRING_CONSTANT(context.
getTime());
damping_constant = DAMPING_CONSTANT(context.
getTime());
animated_parms = myChannelDependent;
if (mass < 0.001)
mass = 0.001;
mySteady = 1;
{
my_C = i;
{
continue;
}
if(animated_parms)
{
spring_constant = SPRING_CONSTANT(context.
getTime());
if (mass < 0.001)
mass = 0.001;
damping_constant = DAMPING_CONSTANT(context.
getTime());
}
{
if(!force_method)
f *= spring_constant;
else
oldp /=spring_constant;
vel = (d1-d2) / inc;
acc = (f - vel*damping_constant - d1*spring_constant)/mass;
vel += acc * inc;
d = d1 + vel * inc;
if (delta > 0.001)
mySteady = 0;
d2 = d1;
d1 = d;
}
}
}
{
if(GRAB_INITIAL() && track)
{
}
else
{
d = INITIAL_DISPLACEMENT(t);
v = INITIAL_VELOCITY(t);
}
if(rate != 0.0)
d1 = d - v/rate;
else
d1 = d;
}
{
"HDK Spring",
1,
1,
}