Difference between revisions of "LlScaleByFactor"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 27: Line 27:
|deepnotes=This function is roughly equivalent to the following:
|deepnotes=This function is roughly equivalent to the following:
<lsl>
<lsl>
float maxAbs(vector a){
float VectorAbsStatistics(integer flag, vector a){
     return llListStatistics(LIST_STAT_MAX, [llFabs(a.x), llFabs(a.y), llFabs(a.z)]);
     return llListStatistics(flag, [llFabs(a.x), llFabs(a.y), llFabs(a.z)]);
}
}


integer ScaleByFactor(float scale) {
integer ScaleByFactor(float scale) {
     vector root = llGetScale() * scale;
     vector root = llGetScale() * scale;
     if(maxAbs(root) > 64 || scale <= 0) return ERR_MALFORMED_PARAMS;
     if(VectorAbsStatistics(LIST_STAT_MAX, root) > 64 || VectorAbsStatistics(LIST_STAT_MIN, root) < 0.01 || scale <= 0) return ERR_MALFORMED_PARAMS;


     integer prims = llGetNumberOfPrims();
     integer prims = llGetNumberOfPrims();
Line 49: Line 49:
             vector size = llList2Vector(get, ++count) * scale;
             vector size = llList2Vector(get, ++count) * scale;
             vector pos = llList2Vector(get, ++count) * scale;
             vector pos = llList2Vector(get, ++count) * scale;
             if(maxAbs(size) > 64 || maxAbs(pos) > 54)
             if(VectorAbsStatistics(LIST_STAT_MAX, size) > 64 || VectorAbsStatistics(LIST_STAT_MIN, size) < 0.01  || VectorAbsStatistics(LIST_STAT_MAX, root) > 54 )
                 return ERR_MALFORMED_PARAMS;
                 return ERR_MALFORMED_PARAMS;
             set += [PRIM_LINK_TARGET, prims, PRIM_POS_LOCAL, pos, PRIM_SIZE, size];
             set += [PRIM_LINK_TARGET, prims, PRIM_POS_LOCAL, pos, PRIM_SIZE, size];

Revision as of 23:48, 5 January 2014

Emblem-important-yellow.png LSL Feature Request
The described function does not exist. This article is a feature request.

Summary

Function: integer llScaleByFactor( float scaling_factor );

Attempts to resize the entire object by scaling_factor, maintaining the size-position ratios of the prims.
Returns an integer boolean, STATUS_* flag or ERR_* flag?

• float scaling_factor The multiplier to be used with the prim sizes and their local positions.

Examples

See Also

Functions

•  llScaleByFactor
•  llGetMaxScaleFactor

Deep Notes

This function is roughly equivalent to the following: <lsl> float VectorAbsStatistics(integer flag, vector a){

   return llListStatistics(flag, [llFabs(a.x), llFabs(a.y), llFabs(a.z)]);

}

integer ScaleByFactor(float scale) {

   vector root = llGetScale() * scale;
   if(VectorAbsStatistics(LIST_STAT_MAX, root) > 64

History

Signature

//function integer llScaleByFactor( float scaling_factor );