Math TLO


Active Member
Is there a way to access the Math TLO from the wrapper?

Tried testing with lines like

DebugOut(((int)VGE.VG().GetMember<int>("Math.Calc[10 + 1]")).ToString());

But no luck so far and I can't the Math TLO listed on the object browser. It's probably something obvious, again :)


Active Member
Could Use
And not even touch the Math TLO...


Active Member
The math TLO is part of innerspace, so this would be more properly asked on the ismods or lavish forums. That said, the incomplete .NET development wiki explains how to get access to any TLO that you like. Poking around at the source of any wrapper should give you the same info...technically a wrapper is just doing this same footwork for you, using the mechanisms for getting at just about any LavishScript object that Lax provides.


The Maestro
Staff member
I'll try and remember to add the Math tlo to the wrapper. It's not an isxvg thing at all, but won't hurt to throw it in there if I can remember to do it.


LavishSoft/InnerSpace Guru
The reason that the Math object is not wrapped in .NET is that it's horribly inefficient compared to doing the same calculation in .NET instead of calling into LavishScript to do it. If you need the distance function for example, it's a lot better to just write the couple lines of code to do it in .NET.

It goes something like this:
double Distance3D(double x1, double y1, double z1, double x2, double y2, double z2)
  double dX = x2-x1;
  double dY = y2-y1;
  double dZ = z2-z1;
  return Math.Sqrt((dX*dX)+(dY*dY)+(dZ*dZ));
And that will run much, much faster than calling the LavishScript equivalent. To use the LS function that does the same thing, it's converting those numbers to strings, then back to numbers, then doing the calculation, instead of just doing a couple fairly trivial calculations. I would recommend NOT wrapping the Math TLO.


Active Member
Thanks guys, all very helpful.

I already went with the custom implementation. My desire to use the TLO is based from a preference to encapsulate the base functionality. In this instance it wasn't very important, but habits are habits :)
Top Bottom