For now, I'd like to jsut post couples of my emails as my diaries:
Hi Casey,
How are you? This is Jun once doing CSCI336 and 356 under you. Haven't seen you around Wollongong campus for a long time, I'm wondering that you are probably in Singapore at the moment.
I'm currently doing CSCI321 project and this is my last semester in my bachelor degree. A group of us are doing a software project called Knot under Luke. The software is to allow users to create and learn how to tie some knots, like this:
We are currently facing a difficulty and although tried many methods many times, we cannot solve it properly. Could you do us a favor and help?
The problem is as bellow:
We use a set of base points (a cycle in the 0 position of the world) as the reference. We calculate a central line (a cubic curve calcuated using a set of control points). Then for each point we pick up on the central line, we try to use Matrix.CreateTranslation and Matrix.CreateRotation to copy, move and rotate the base cycle to get the surface points we want on the cube. The following code is what we are using. It seems only the translation is working:
Matrix magicMatrix = Matrix.CreateTranslation(calVectors[i]); // calVectors[i] is a point on the central line
Vector3[] newCycle = new Vector3[cyclePointNumber]; // cyclePointNumber is the number of points we take from the base cycle
Vector3.Transform(baseCircle, ref magicMatrix, newCycle); // baseCircle is Vector3[]
Vector3[] newCycle = new Vector3[cyclePointNumber]; // cyclePointNumber is the number of points we take from the base cycle
Vector3.Transform(baseCircle, ref magicMatrix, newCycle); // baseCircle is Vector3[]
By doing so, we get some unwanted cube geometries --- when the geometry goes horixontally, it becomes flat, as shown on the image bellow:
To solve this problem, we tried something like:
Vector3 currentCircleDirection = calVectors[i+1] - calVectors[i];
currentCircleDirection.Normalize(); // get the current direction of the current point on the central line
currentCircleDirection.Normalize(); // get the current direction of the current point on the central line
Matrix magicMatrix = Matrix.CreateTranslation(calVectors[i]); // move to new position
After translation, how can I use the currentCircleDirection to rotate the circle properly? Using Matrix.CreateRotationX, or Y, or Z? Or do something like magicMatrix.Forward = currentCircleDirection?
We tried many formulars and tests, but all failed. How can I use the currentCircleDirection to not only make the magicMatrix have the right info of the new position, but also have the right direction (rotation)?
Thanks very much for your time Casey!
Warm regards,
Jun
No comments:
Post a Comment