MoI discussion forum
MoI discussion forum

Full Version: Conformal Mapping to the Torus

Show messages:  1-7  8-27  28-45

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
From: speedy (AL2000)
30 Jan 2019   [#21]
Hi Brian and Friends
An unconventional mapping on the Torus,
using your first Script ...
with some further precautions, I can get R1 and r,
and most importantly, the central point to the mapped hexagons
normal to the surface ..
This gives me the possibility to act on the basic hexagon for further transformations ....
I saw your new Script and it's Ok ...
it would be interesting if I could provide in output, the mapping of the Hex-normal face centers to the Torus Surface,
it would be a formidable tool for subsequent Transformations ... what do you think?
In any case, thanks for this last improvement-
As usual, the file is at this link:
http://www.mediafire.com/file/9au0nfcccmiog8z/CP_CMArrayHex.zip/file
Have a nice day to all
alberto
From: Karsten (KMRQUS)
30 Jan 2019   [#22] In reply to [#16]
Hi Brian,

>>>>>The few nodes with more than one output slot seem to have the same number of elements in each output?
Ehm -no. number of Outputs and Type, and also the number of elements are independent.

>>>>> The number of declared outputs must equal the number of outputs defined, or there is an error...?

Each declared Output (addOutput) should also be defined (this.setOutputData) means - give it a value - that's the sense. The different outputdata are stored in an array for the different Outputs. The setOutputData method needs an index where to store the generated data in the array. If a method try to Access the Output Array of a node, the method should find data with the right types - I'm not sure, but I think Max places empty data with the right type to the Output Array by default while Output creation to avoid problems. At the end the Outputs are this Array.

Have a nice day
Karsten
From: bemfarmer
30 Jan 2019   [#23] In reply to [#21]
Hi AL2000,

The centers of the flat torus are available. Their conformal mapping should be the center of the mapped hexagons. (?)
To form vector, the start point is a corresponding point on the Rcircle, which is the center of the rcircle through the corresponding center point of the hexagon.
Each of such start point can also be calculated from u and v. (?).

This should be fairly easy to code in the .js. I'll try...

- Brian
From: bemfarmer
30 Jan 2019   [#24] In reply to [#22]
Thank you Karsten.

Is there an example *.js node which outputs many objects, and only one, say a circle?
(My attempt to output one circle resulted in output of as many copies of the circle as there were objects output...)


- Brian
From: Karsten (KMRQUS)
30 Jan 2019   [#25] In reply to [#24]
Hello Brian,
PatternSelArray, getCrvSFrame, ... gives independent different Outputs with different length.

it sounds that you tried it in a multiprocess function. Okay - could you post an example of the code? It is easier for me to figure out what happens on an code example.

Have a nice day
Karsten
From: bemfarmer
30 Jan 2019   [#26] In reply to [#25]
Hi Karsten,

Attached is a new .js node BADConformalMap, which will run in the node assemblage in about 12 seconds, but makes 100's of circles, instead of only 2.
The BadConformalMap.js can simply be copied to the nodeditor/node/extension folder.

The node assemblage is "ConformalMappingHexGridToTorus4BAD.

(Modifying the .js file requires that its former copy in the node assemblage be replaced with the modified version.)

I guess that a second multiProes needs to be added???


- Brian
From: Karsten (KMRQUS)
31 Jan 2019   [#27] In reply to [#26]
Hello Brian,

it is a Problem with the using of the multiprocess function. It is in your case not necessary to us it. It's more useful to use it for multiple data with n x m permutations. The core System calls it - depending of the mode for each data object in the Input stream. You have to create dummies for the Output in it, because the core System try to evaluate an Array of results as Long as the defined Outputs.
I've made some changes to your file - please study it. At the end it would be better and faster to process your curves in a for-loop and not in a multiprocess function.

Have a nice day
Karsten

p.s.: Nevertheless -Congratulations! It Works:-)

Attachments:
Mapping.js


Show messages:  1-7  8-27  28-45