PDA

View Full Version : scale a x,y curve

FrankyGTH
07-27-2009, 01:45 PM
hi dear lw scripting friends :)

I am looking for the right syntax for "scale"

s.x = scale(0.5,0.5); // something is wrong here

// s.x = scale*(0.5,0.5); // not ok ;(

s = <Scale,0.5,0.5>; // ok

perhaps anybody can help, best regards, FrankyGTH

evenflcw
07-30-2009, 07:32 AM
Saw your second post aswell. I'll answer here because it was the right place.

The reason I did not answer sooner was because your post was confusing. I was hoping you either got an "aha!" moment without help or posted more info to clear up the confusion. You did somewhat with this last line.

s.x = scale(0.5,0.5); //the returned value is not the result of 0.5*0.5, but a "status", likely indicating whether there was any error (which is highly unlikely to ever happen).
s.x = scale*(0.5,0.5); //x*(y,z) notation is not proper Lscript syntax and illegal. scale is considered a variable. If you haven't initialized it you shouldn't be using it.
s = <Scale,0.5,0.5>; //again. Scale is considered a number variable (single number). s is a vector (3 numbers). I don't know what your plan was with this so I can't comment further. :)

how can I scale a curve with a scaling factor?
You seem to be using the scale() command as a number cruncher. It is no such thing. It doesn't take two factors and return the results. It takes two parameters and transforms the selected points in Modelers interface! The value returned (the status) from the function is likely of no interest to you.

LScript doesn't provide functions for basic arithmetical operations like addition, subtraction, multiplication and division. You must use the signs (+-*/).

If you do want to transform the mesh (rather than just crunch numbers). The syntax for scale() commands can be abit akward because it is so (too?) flexible with what input parameters you can give it. I don't want to repeat the manual so I'll just provide some supplement and examples. But you should really just play with it until it makes sense.

scale(amount, [center])
Input can be either a number or a vector (3 numbers, one for each major axis;<x,y,z>). Providing a number is the same as providing a vector with the same value on all axes. Ie, scale(3) is the same as scale(<3,3,3>).

scale(2)
scale(2, 0)
scale(<2,2,2>,0)
scale(<2,2,2>,<0,0,0>)
All these are equivalent. They scale the selected geometry to double its size (along all axes), using origo as the center for the operation.

scale(<1,2,1>, <2,2,0>)
Doubles the height (y) using coordinate <0,2,0> as center for the operation. The first 2 in <2,2,0> is pointless as the command scales only along major axes.