MoI discussion forum
MoI discussion forum

Full Version: Conformal Mapping to the Torus

Show messages:  1-20  21-40  41-45

From: bemfarmer
22 Jan 2019   [#1]
After considerable study and play, a hexagon grid was conformally mapped to the surface of a torus. Kagome grid was mapped also.
Also I've written my first nodeeditor node called conformalMapT, where T stands for the Torus. The new node is included as a fourth node in Transform2MOD.js.
Just copy the Transform2MOD.js file to nodeeditor/nodes/extensions. (This duplicates the old 3 nodes.) Amazingly, somehow the node gets included in Transform2 menu. HOW or WHY is unknown.
(The Transform2 node should be replaced with the new .js, with the same name.)
The conformal mapping preserves angles locally, whereas nonconformal map shrinks and stretched curves.

The new conformalMapT node is really just a modification of Karsten's stereoProject node, which is itself a conformal mapping from the plane, to the sphere. It is actually an inverse of the regular stereoprojection from the sphere to the plane. (So it turned out to not be very much work, just swapping out a few parameters and equations.) I would like to ask Karsten where he got his lambda equations? I did change the mode to 1, which is likely "Short".

References and credits, and considerable documentation is included in the attached PDF.

The mapped hexagon sides can be easily Joined by MoI, and a 3 point (to be swept) circle easily created on the torus, as well as the sweep circle, to create the surface of the torus.
The torus surface may be trimmed by selecting all of the joined mapped hexes, in MoI. (Should be possible too in nodeeditor?)

A nonconformal hex mapping would only require changing a few equations.

Also, it should be possible to map other planar curves and points onto a torus. Also triangle grids, and small rectangular grids.

I do not know how FLOW works, or if it is conformal...

- Brian
Edit, see post 18 for upgraded files...











Image Attachments:
SilverHexTorus12x24.png 


From: Michael Gibson
22 Jan 2019   [#2] In reply to [#1]
That's a cool one Brian! So the Flow command works just by making a mapping from the base surface to the target surface. A point on the original object is mapped to the closest point on the base surface which gives a u,v value in the base surface's parameter space. Then that same normalized u,v value is evaluated on the target surface. So the result is dependent on the parameterization of both surfaces and does not have any special properties for preserving distances or angles or such things.

- Michael
From: Karsten (KMRQUS)
22 Jan 2019   [#3] In reply to [#1]
Hello Brian,

great stuff. I have to Play with it the next time:-) The menu is set not by the filename - it is set here: LiteGraph.registerNodeType("Transform2/conformalMapT", conformalMapT);

The equation for stereoscopic projection come from here:



The formula was in my pencil;-)

Have a nice day
Karsten

Image Attachments:
20170131_124316.jpg 


From: speedy (AL2000)
22 Jan 2019   [#4]
Hello Brian
I just took a quick look ...
I promise to investigate everything later ...
Meanwhile, Congratulations on your entry into NodeeditorWorld
have a nice evening
alberto
From: bemfarmer
22 Jan 2019   [#5]
Thank you Michael, Karsten, and Speedy.
From: speedy (AL2000)
24 Jan 2019   [#6]
Hi Brian and friend
I did this test using your tool,
I have to say a lot of performance, even if I get it
the data of Torus, R1, R, are not for me so obvious
I did not read much
deepened of your notes, but from what I see
I need a considerable depth
to understand more ...
I ask you if I could, using input data
make the mathematical passages to obtain the data, R1 and R of the Torus
would be great....

as usual the file at this link:
http://www.mediafire.com/file/8u9h7yywc40n29f/CP-Conf.Map._Hex_Grid_T.Torus._Solid.zip/file
Thanks in advance
al
From: bemfarmer
24 Jan 2019   [#7] In reply to [#6]
Hi Al,

I'll do some more work on the ConformalMapT node.
Add point mapping.
Add poloidal circle of radius r, with center at (r,0). associated with angle theta.
Add toroidal circle of radius R, with center at (0,0). associated with angle phi.

The two circle outputs could then be swept, to yield the torus surface.

T is associated with circumference of T units, and r and v and theta. (2PI*r = T) (edit, this statement is FALSE)
S is associated with circumference of S units, and R and u and theta. (2PI*R = S) (FALSE statement)
(The div divider in the conformal mapping reduces the size of the Torus...)

Note that input of integer 2 to the Columns input of the FlatHexGrid macro, will map only two columns.
The rest of the columns can then be created by circular array.


I've attempted to write (by equation change) a NonConformalMapT, but after several corrections, have only created an ellipsoid (M&M candy),
not a Torus :-( , which shows some incorrect thinking...
OK, fixed. It helps to put the parenthesis in the correct locations.

Your .nod is crashing my computer. I'll try some examination and earlier outputs...

Rebuild with tolerance of .001 may be helpful...

- Brian

( I see that you are making some smaller/offset hexagons. Probably the goal is to make the hex curves into 3D bars, with square cross section.)
(I have not had much luck sweeping circles along the curves.)
From: bemfarmer
24 Jan 2019   [#8]
Some preliminary thoughts:

Currently, for the domain (source) rectangle, the z coordinate is zero.

Mapping 3D thick bars, rather than lines, might be possible?

How to scale the torus by a percentage of r, while keeping R constant?

- Brian
From: bemfarmer
24 Jan 2019   [#9]
Simple equations for normals to the torus are available.
So it should be easy to scale each conformal point input to the hexagon sides interpcurves, by a small amount, so as to get an radius offset to the tiling.
To Fatten the curves.
- Brian.

(Mapping a slightly distorted flatTorus grid did not seem to make any sense...)
From: bemfarmer
25 Jan 2019   [#10]
The pipe script places tubes around the curves.
Boolean union creates some holes.
From: speedy (AL2000)
25 Jan 2019   [#11]
Hi Brian and friends
Waiting for your updates to the ConformalMapHexGrid on Torus;
applying a bit of Logic and the Box-info Tool
Being the topology of Torus quite simple
you can get R and r
file and imagine this link:
http://www.mediafire.com/file/kg3m8rd4r6nrc1z/CP_CMHexGrid-R%252Cr.zip/file
Have a nice weekend all
al
From: bemfarmer
25 Jan 2019   [#12] In reply to [#11]
Hi Speedy,
You have some nice techniques.

Ran you node:
Your r circle seems to be the correct diameter, to 7 decimals, but its center point, which is at radius R, is slightly too small. IMHO
Trim of your torus surface by the curved hex grid does not work properly.


I've been getting the r circle by MoI 3 point circle selection of midpoints of the sides of 3 separately spaced hexes.
The center of the r circle is at radius R.
Sweep of these circles, with R circle as rail, yields a torus surface which can be trimmed by the curved hex grid.

Still working on modifying the Conformal node...
I want to try a small scaling reduction along the surface normals.
Surface normal formula is:
phi is toroidal angle, the angle made by R radii.
theta is poloidal angle, the angle made by r radii.
normal at f(phi,theta) is:
X = cos(phi) * cos(theta)
Y = sin(phi) * cos(theta)
Z = sin(theta)

So scaling each conformal curve point by say 98%, using the vector XYZ, should yield "Fatline" curves?

The other possibility is to start with the hex grid, 2D scale back the y values by say 95 %, which reduces r by 98%, and running the node again?
(R constant means that S is constant, so the mapping must squeeze the inner hexes more in the toroidal direction, and stretch the outer hexes less in the toroidal direction?)
The aspect ratio of the 2% reduced torus will change, so a little bit of angle distortion will be introduced?

- Brian
From: bemfarmer
26 Jan 2019   [#13]
NonConformalMapT node is working.

Preliminary layout of enhanced ConformalMapT:

Scaling to say 98% of Torus tube diameter may be accomplished by vector subtraction.
let vecA = vector (point) from origin to the conformal point on torus surface.
vecB = vector (point) from origin to center of rCircle. (The rCircle passing through the conformal point.)
vecC = vector (point)from said center of rCircle to conformal point on surface of torus, (which is parallel to the surface normal there).
vecD = scaled vecC.
vecE = vector (point) from the origin to the scaled conformal point lying inside of the torus surface, below the conformal point.

vecA = vecB + vecC, so vecC = vecA - vecB.

vecD = vecC * 98%. //scale length.
vecE = vecB + vecD.

Form a curve from the vecE points generated from the many conformal points.
- Brian


Image Attachments:
conformalNodePNG.png  VectorsABCDE.png 


From: bemfarmer
26 Jan 2019   [#14] In reply to [#13]
FLOW easily maps a curved polygon on the surface of a torus, to a second torus.

>>>The second skinny torus can have the same R radius, with a smaller r radius.<<<

(The second torus can be scaled, but this should be equivalent to just scaling the original torus and surface polygon.)

- Brian

The inner curved polygon is less conformal, angles are no longer preserved. But for a small offset, this should not be very noticeable.
From: bemfarmer
28 Jan 2019   [#15]
After 8 pages of algebra, I finally figured out how to code the two circles in the conformal map node.
The conformal formula shrinks the size of the torus down quite a bit.

Thanks to multiprocessing (I guess) there are actually 1,728 circles times 2, until I learn how to properly code the conformal mapping node.
(So Hide two and delete the rest of the circles.)
(Add two output nodes to the rRadius and RRadius outputs of the node.)
Some different colors would be nice. Silver works well for the circle sweep.

The NonConformal mapping to larger torus node is included, but r & R radii have not been added yet.

Like the WN.js nodes, the mapping nodes could be put in a similar extension to an extension .js file...

Rebuild of hex curves, with tolerance .001 is recommended.
I need to modify the FlatHexGrid to produce smaller hexagons, with the same center spacing. (As per speedy/AL.)
Sweeping the circles, FLOW to smaller torus, and trimming of the two tori surfaces by hex curves can likely be done with standard nodes.

So there is still more work to be done.

- Brian

Edit: I do not know how to output only 2 circles, along with many hexagon sides, so may write a helper node to calculate the 2 circles.
From: bemfarmer
28 Jan 2019   [#16] In reply to [#15]
It seems like most nodes have only one output slot.
The few nodes with more than one output slot seem to have the same number of elements in each output?
- Brian

The number of declared outputs must equal the number of outputs defined, or there is an error...?
From: bemfarmer
28 Jan 2019   [#17] In reply to [#16]
On second thought, I'll just incorporate the conformal map node into a macro. :-)
- Brian
From: bemfarmer
28 Jan 2019   [#18] In reply to [#17]
Created Macro for conformal rCircle and RCircle.
Sweep node of the two circles works easily. About 12 seconds or so...
Placed the two nodes conformal and nonconformal mapping into a separate file, which can be copied to the nodeeditor/nodes/extensions folder.
Delete the transform2Mod files.
Added 90% to 100% scaling of individual hexagons. The number of columns and rows and planar domain remain the same size.
Added throughpoint curve, in addition to interpcurve "type". They are nearly identical, except at high magnification.
Added a Switch widget to switch between forming a full torus "grid", and a two column only grid, which is faster, and circle array-able.
(Did not add circles Macro for nonConformal node yet. Should be extremely easy...)

After forming the torus grid at 90%, do Rebuild and Join of hex sides.
Then do trim of torus by the grid. This takes over a minute or so.

For the previous nonconformal node assembly, replace the nonconformal node with a new copy.

- Brian

Have not done a FLOW shrinkage yet...


Attachments:
ConformalMAP2019.zip

Image Attachments:
HexGridTangerineTango02.png 


From: bemfarmer
28 Jan 2019   [#19] In reply to [#18]
A couple of days ago the FLOW "shrinkage" worked.
Tonight FLOW is squashing and squeezing the hex "ribbon." :-(
Will make a fresh try tomorrow, or so.
- Brian
From: bemfarmer
29 Jan 2019   [#20] In reply to [#19]
In an aha moment this morning: In order for FLOW to get the expected result of shrinking the pattern on the mapped torus, onto a torus of smaller r radius, and equal R radius,
it is necessary for the two tori to have the "seam" edge in equivalent locations. In this case the seams can both be in the center curve of the two donuts.
Otherwise the squish and stretch effect will occur as the inner hexes and outer hexes swap places.

(For special effects the seams could be located differently.)

- Brian

Show messages:  1-20  21-40  41-45