Wednesday, September 28, 2016

Define: Torus Creation in Maths : - )

THIS TOPIC is Wholly Cited From WebSite 

By FxIII

First, thanks for the original author, FxIII's work :-)..

[references]
1. "The Torus and Supertoroid", by Paul Bourke, 1990.
2. "Torus", by Eric Weisstein
_______
To understand fully what I will say, you need to know some basic vector algebra:
  1. vectors sums: X:=(x1,x2,x3), Y:=(y1,y2,y3); X + Y=(x1+y1, x2+y2, x3+y3)
  2. scalar multiplication: X:=(x1,X2,x3); a·X = (a·x1, a·x2, a·x3)
  3. norm: |X| = √(x1·x1 + x2·x2 + x3·x3)
  4. [optional] scalar product: X·Y= (x1·y1 + x2·y2 + x3·y3) so |X|² = X·X
  • Our Torus will be centered on C, 
  • its first diameter (d) will be parallel to the XY plane and 
  • the second diameter will be d'
  • we will use u to run on the first circle and
  •  v to run to the second cicle
  • and where both u andv will go from 0 to 2π.

first diameter
As you see, we use u to compute the point P on the circle centered on C.
 We now need to construct a second circle like this that is centered on P and parallel to the direction C->P. I hope this image explains what I mean:
what I mean
The reddish circle is constructed same as the first, with a difference: the circle does not lies on a standard plane but on the plane parallel both to the Z axis and the C-->P direction (the segment lebeled d).
Lets think about the first circle: when we say
P=C + d *(cos(u), sin(u), 0)
we are telling that
component adding
where X = (1,0,0), Y = (0,1,0), Z = (0,0,1): the "component adding".
We can do the same for the second cicle using P as center, discarding the third component (as it is zero), using the Z axis as for the sin component and the W axis for the cos component.
The W axis is simply an arbitrary axis that we construct so it is directed from C to P and has unitary length (as XY and Z were).
The norm of a vector is its length so we can define W as follows:
W=(P-C)/|P-C|
we take W' = P - C because it the vector that "moves" C to P ( C + W' = C + P - C = P); then we setW to have the direction of W' and the length of 1.
This is the result:
result
Now you have a way to compute the point Q in terms of u and v.
Noticing W is always (cos(u),sin(u),0), we can put it all together and write the function Q(uv):
Q(u,v)
You can now construct your quads by connecting: (uv) -> (uv+1) -> (u-1, v+1) -> (u-1, v)
For triangles, only connect:
(uv) -> (uv+1) -> (u-1, v) and
(u-1, v) -> (uv+1) -> (u-1, v+1)

No comments:

Post a Comment