OZONE Asylum
Forums
Server-Side Scripting - Oh my!
What's wrong with this rotation?
This page's ID:
27850
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Hello world. It's getting late and I finally managed to get a quick bugfix for an OpenGL issue. Basically, I have two vectors in 3d space, and the angle between them should tend towards 0. It tends to that in most cases, but in some, it tends towards "minus infinity", and this is the limit of my bugfix: I can't seem to be able to get rid of.. wait a minute, just had an idea about the cause. Anyway, I figured I'd post the code which sometimes returns minus infinity. It shouldn't, unless I've forgot something about the acos function in maths... (scratches head... shouldn't do maths at 1AM I guess, but hey..) [code] GLfloat vectorMaths::angleBetween(vertex * v1, vertex * v2){ GLfloat dotprod = v1->x*v2->x+v1->y*v2->y+v1->z*v2->z; return (GLfloat)acos(dotprod / (length(v1) * length(v2))); } [/code] [small](Edited by [url=http://www.ozoneasylum.com/user/5827]_Mauro[/url] on 04-28-2006 01:11)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »
Maximum Security
OZONE
DHTML/Javascript
Server-Side Scripting - Oh my!
CSS - DOM - XHTML - XML - XSL - XSLT
Stupid Basic HTML
Visual Therapy
Photoshop
Photoshop Pong, Anyone?
***WARNING*** BIG SIG APPROACHING
Photography
3D Modelling & Rendering
Multimedia/Animation
Print Graphics
Holding Pens
Philosophy and other Silliness
Outpatient Counseling
Site reviews!
Mad Scientists' Laboratory
Getting to know the Grail