PDA

View Full Version : Quick Speed Question



DLink
02-13-2001, 12:29 PM
Here's kind of a dumb quick question, I'm playing around with some vector math for my engine, and I'm seeing places where I have choices to use Trig or straight algebra....(mostly to calculate distances and vector components)

Well, here's the question: Is it generally faster and better to perform trig functions like sin and cos, or to perform square roots? (Is there any hardware acceleration involved in either of them?) I know that square roots are slow, but they may be a necessary evil in calculating distances....

Does anybody have any suggestions about this?
(Oh yeah, sorry that this isn't directly OpenGL realated)

-Thanks! http://www.opengl.org/discussion_boards/ubb/smile.gif

DFrey
02-13-2001, 12:40 PM
Square roots can be quite speedy if you approximate them with either a look up table, or a SIMD implementation (SSE or 3DNow for example). Look on the advanced OpenGL coding forum for a current thread related to this topic.