Notifications
Clear all

[Closed] Useful mxs sdk extension functions

this also seems to work !

two intersectRay functions that actually work with an editable poly they work in exactly the same manner as the editable mesh versions (only they don’t return undefined when you pass them an editable poly ) theres a slight difference with the Ex version the bary coords are returned as an array of length facedegree in corner order not a point3 though only 3 of the array have actual values depending on which face tri was hit, all the others will be zero.

rrrrrrrrrrrrrrrrrrrr

a couple a simple matrix3 routines that should be in the mxs core.

function to match to the previous getShapePolyLine function posted earlier.

will return the the curve param (0.0-1.0) or the curve length of the actual interpolated points, will take into account of optimize and adaptive. Useful for retrieving the interpolate tangent at points return by getShapePolyLine .

returns the screen space bounding box of a node as a box2 value (note this returns the screen space for the local bounding box so it may not be that “tight” if a tighter box is required a version processing all the verts into screen space to compute the box would be needed).

heres the more precise version, will handle 100 or so 40,000 tri nodes in about 130ms

more an public information post than a useful function.
I was playing with the mxs function

to see how it compare with something I could write in the sdk

anyway in the tests 1000 arrays with 1000 indexes it runs at about
0.75 ms

now the traditional (mxsagni project) method would produce a function like this

this code will run at about 0.71ms which looks pretty good for the mxs function.
But if we try a different approach in the sdk

not using the append runs at about 0.069ms !!! so 10 times quicker. Its a little upsetting because the append method is used everywhere in mxs where an array is returned

it does work in some cases, but unfortunately can throw up some unusual errors with the garbage collector, without knowing exactly what the append function does it would be tricky to duplicate.

a couple functions inspired by another thread, return mesh element faces as arrays of face bitarrays.

a couple of stl memory allocators so stl containers can use memory in the maxheap.

Page 9 / 18