vectors and dot products

Post ideas & suggestions you have pertaining to the game here.
Post Reply
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Hi George,

I can not remember if we already talked about this on the forums, but I can not seem to find it.

I was wondering if there is a particular way in tscript to get the dotproduct of two vectors. Since we don't really have any cos/sin functions and vectors themselves are the format they are, i can not see a way of doing it with the basics. Is there something I have missed, or would a sysVectorDotProduct be in order?

I ask since the most algorithms that implement target leading use the dotproduct a lot, and I can imagine there are a score of other cases where it could be useful when doing space trig :D
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

The fundamental problem seems to be that vectors use long integers broken into two integers as seen by the script.

With arithmetic functions for manipulating a long integer represented as a list of two integers the dot product would be trivial to implement.

EDIT:

It appears they're floats, and not a custom implementation with a 32 bit radix and 32 bit mantissa, which means there's not a thing that can be done in script without breaking them up into bits.

This means we need compiled functions for floating point arithmetic including square root to emulate the aiming code in script.

Making the aiming code accessible in script would work too, but be less flexible.
Post Reply