Solved

geometry tranform problem

Posted on 2004-09-16
4
197 Views
Last Modified: 2010-04-07
Hi,

My linear algreba's a little shaky, hence the question...

I have a non axis aligned box parameterised something like:

vector3 center
vector3 extents
vector3 eulers

To draw this thing I apply transformations like this:

extents -> eulers -> center
ie. scale -> rotate -> translate

I want to recalculate the translate when I update the scale to give the same tranformation such that a particular side of the box remains in the same position.

The box is editable by the user who can pull the edges to scale the box, or use a widget to rotate the box. With zero rotations the box behaves ok, I calculate the center to compensate for the adjusted edge. However when the box is rotated this calculation is not so simple I cannot get the same behaivour, the box moves around.

The end result needs to be a 4x4 matrix that represents the tranformation so there maybe another representation would be better.

Any help really appreciated.

faraz
0
Comment
Question by:_faraz
4 Comments
 
LVL 2

Expert Comment

by:cmreichl
Comment Utility
The reason for this behavior is that the rotation equations your using are doing calculations about the origin...   Therefore if your object is not at the origin the whole object is then rotated as if the origin was its center.  An easy fix would be to remember its center, convert the numbers to the origin, and then convert back once rotation is calculated.  (Since your just calculating numbers and not actually moving the object, this isn't an inefficient method).

-Chris
0
 

Author Comment

by:_faraz
Comment Utility
This was my original 'solution', however it doesn't really give the expected (from the user's point of view) result. The user expects the rotation to occur about the current center of the box, not the original center. As the box is scaled the center obviously shifts, the rotation occurs around the correct center before the translation is applied, but this invalidates the translation.

I think the problem is actually more to do with keeping the opposite edge to the one thats begin moved stationary.

It may be simpler to work by transforming faces/vertices (user experience is the same) then calculate the matrix from the vertices when I need it, maybe with the coord frame defined by the planes since this bit is not performance critical. That way I'm not dealing with a representation based on transformations, I just apply a transformation to vertices as I need it.

hmm...I'll give this ago, thanks for your help (got me thinking about this in a different way!)

faraz
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now