Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
TorqueScript Math Extension
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Zeus  
View profile  
 More options Apr 16 2007, 1:07 am
From: "Zeus" <billco...@gmail.com>
Date: Sun, 15 Apr 2007 22:07:12 -0700
Local: Mon, Apr 16 2007 1:07 am
Subject: TorqueScript Math Extension
This is primarily for Jess and Noah.

All variables in TorqueScript are represented by strings, which means
every time you do floating point calculations there's a string->float-

>string conversion, introducing small errors. With enough

calculations, the errors become rather large.

So, I developed an extension to TorqueScript which introduces two new
classes. mexFloat and mexVector. mexFloat is used for floating point
calculations. mexVector is used for vector calculations. They both
store their values internally, on the C++ side, so there are no string-

>float->string conversions when doing math with them.

Here are the files:
http://www.progranism.com/junk/TorqueMathEx/mexfloat.h
http://www.progranism.com/junk/TorqueMathEx/mexfloat.cc
http://www.progranism.com/junk/TorqueMathEx/mexvector.cc

Those simply need to be included in the project and the project re-
built. Or you can just download my EXE:
http://www.progranism.com/junk/TorqueMathEx/torqueDemo.exe

Usage is pretty simple. Just be careful around the constructors and
set functions. Some take strings, some take mexFloat, and some take
TorqueScript string/numerical values.

Example:
%a = new mexVector(0, 0, 1);
%ap = new mexVector(1, 3.9, 5.8);
%a = %a.normalize();
%ap = %ap.normalize();

%vec = %a.cross(%ap);
%theta = %a.dot(%ap).acos();

%rotation = %vec.getValue() SPC %theta.getValue();

/////////////////////////////////
echo(new mexFloat(2).add(new mexFloat(3)).divide(new
mexFloat(42)).getValue());  // 0.11904761904761904761904761904762

///////////////////////////////////
new mexVector().setValue(new mexFloat(5), new mexFloat(2), new
mexFloat(8));

Jess: I'll send you a copy of the spawnRail function that uses the
Math Extension. I hope it helps! My few tests show the Math extension
to be more accurate. Not by a whole lot, but hopefully it's enough to
get those rails on spot.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »