|
|
Here are some little macros that have recently saved me a lot of typing. I
also submitted them to Twyst's #MacroScope (and I recommend you send your
macros there, too)
I hope you'll find these useful
Improved interpolation function
GC - global current
GS - global start
GE - global end
TS - target start
TE - target end
EXP - interpolation exponent (linear, cubic etc.)
#macro Interpolate(GC,GS,GE,TS,TE,EXP)
(TS+(TE-TS)*pow((GC-GS)/(GE-GS),EXP))
#end
Vector debug, saves a lot of typin when generating debug streams for 3D
vectors
Requires the vector identifier
#macro v_debug(V)
concat("<",str(V.x,0,3),",",str(V.y,0,3),",",str(V.z,0,3),">")
#end
Put point at the axis defined by P1 and P2, at a specified distance from
P2; negative distance values move the point from P2 towards P1
P1 - start point
P2 - end point
Dist - distance from P2
#macro v_lineup(P1,P2,Dist)
(P2+vnormalize(P2-P1)*Dist)
#end
Creates random number of given mean and maximum deviation, for example
rand_ext(1,0.2,Seed) gives a random number between 0.8 and 1.2
M - mean value
D - maximum deviation
Seed - (previously declared) random number seed identifier
#macro rand_ext(M,D,Seed)
(M+(rand(Seed)-.5)*2*D)
#end
Post a reply to this message
|
|
|
|
What does what do? The interpolation funcion?
Linear interpolation returns a value which is (proportionally) at the same
distance between TS and TE as GC is between GS and GE.
EXP > 1 makes the value "accelerate" as it goes from TS to TE, i.e. it changes a
little towards the start and a lot towards the end.
EXP < 1 makes the value "decelerate"
Sorry, lost count of the words ;)
Margus
Mike Weber wrote:
>
> In 25 words or less, what does it do?
>
Post a reply to this message
|
|