MantisBT - opensim
View Issue Details
0004752opensim[REGION] Script Functionspublic2010-06-04 21:442010-07-09 18:53
Micheil Merlin 
dahlia 
normalminoralways
closedfixed 
master (dev code) 
master (dev code) 
See SVN Revision
Standalone (1 Region)
ODE
.NET / Windows64
None
0004752: [PATCH] llVecNorm with a zero vector returns NaN values due to division by zero.
This is a fairly minor issue but it would be cleaner to return zeros instead of NaNs.

Sample script.

default
{
    state_entry()
    {
        llSay(0, "Script running");
    }
    
    touch_start(integer num)
    {
        vector vec = <0.0, 0.0, 0.0>;
        llOwnerSay("Vector " + (string)vec + " Normalized " + (string)llVecNorm(vec));
    }
}

Output:

[21:37] llVecNorm Test: Vector <0.000000,0.000000,0.000000> Normalized <NaN,NaN,NaN>


No tags attached.
patch llVecNorm.patch (979) 2010-06-04 21:44
http://opensimulator.org/mantis/file_download.php?file_id=2370&type=bug
Issue History
2010-06-04 21:44Micheil MerlinNew Issue
2010-06-04 21:44Micheil MerlinFile Added: llVecNorm.patch
2010-06-04 21:44Micheil MerlinGit Revision => See SVN Revision
2010-06-04 21:44Micheil MerlinSVN Revision => 896
2010-06-04 21:44Micheil MerlinRun Mode => Standalone (1 Region)
2010-06-04 21:44Micheil MerlinPhysics Engine => ODE
2010-06-04 21:44Micheil MerlinEnvironment => .NET / Windows64
2010-06-04 21:44Micheil MerlinMono Version => None
2010-06-04 21:46Micheil MerlinDescription Updated
2010-06-04 21:47Micheil MerlinStatusnew => patch included
2010-06-04 21:57Micheil MerlinProduct Version0.6.9 => master (dev code)
2010-06-05 06:29DoranZemljaNote Added: 0015579
2010-06-19 15:56Micheil MerlinSummary[patch] llVecNorm with a zero vector returns NaN values due to division by zero. => [PATCH] llVecNorm with a zero vector returns NaN values due to division by zero.
2010-07-08 10:13dahliaNote Added: 0015942
2010-07-08 10:13dahliaAssigned To => dahlia
2010-07-08 10:13dahliaStatuspatch included => patch feedback
2010-07-09 18:50Micheil MerlinNote Added: 0015958
2010-07-09 18:53dahliaStatuspatch feedback => resolved
2010-07-09 18:53dahliaFixed in Version => master (dev code)
2010-07-09 18:53dahliaResolutionopen => fixed
2010-07-09 18:53dahliaStatusresolved => closed

Notes
(0015579)
DoranZemlja   
2010-06-05 06:29   
+1
(0015942)
dahlia   
2010-07-08 10:13   
I made a similar change in a lower level function. Please try git master version * rdf9d4cd9b2c
(0015958)
Micheil Merlin   
2010-07-09 18:50   
llVecNorm now returns a zero vector.
Thanks.