# Surface from planes (using planes z-axis as face normal at that point) ||| Planes still on XY-Plane and need to be moved on z-axis acrding to angle

Hi I have abunch of planes that are currently laying flat on the xy-plane

the planes have different rotations as you can see here

-> I am aware that some of the planes are to steep for this to work properly but I already have a solution for this

so what i basicly want to do is this :

-> the red are planes at current position (simpified)
and i want to find out how far i have to move them on the z axis for them to create a surface where the planes are the tangent line on that point of the curve

if anybody has an idea I would greatly appriciate the help

thanks

Hi Chris!

See this concept/algorithm.
(Iâ€™m not a mathematician or suchâ€¦ take everything i say/post as an option from a hobbyist)

What you have are derivative values, to rebuild you need to do the integral of those values.

I interpolated point locations and vectors (with catmull interpolation).
With mass addition > partial result, every point is moved in Y for the sum of all previous point/vector.
Number of samples is highly relevant.

Less words, see attached gif.

integral.gh (19.5 KB)
Point spacing is even, maybe with an uneven spacing it give wrong results (or wronger).
I donâ€™t know if this is correct, this is very likely do be doable by pure math very better. (sorry for my english)

You didnâ€™t attach you data, so i created this to try the concept.

You have many vertical planes (near flat/horizontal planes!)â€¦ an analogue 3d version of this algorithm wonâ€™t work.

1 Like

Hi Riccardo

that looks very interesting. I just took a real quick peak at it because I donâ€™t have much time now.

I will take a more indepth look at it first thing tomorrow morning! but looks very promising. Going to let you know how i do!

thanks so much in the meantime

chris

Hi
Iâ€™m back. sorry to get back to you so late

this looks really good.

it does exactly what i need for the simple version with just some vectors in 2d

do you have a suggestion on how to go about it in 3d when the planes are scattered about and not in some kind of grid?
I am new to GH and not sure if there is a simple adaption from what you showed to the 3d surface

chris

I was thinking about it â€¦ somehow.
A first â€śtranslationâ€ť that came in my mind would require a 4-dimensional space environment â€¦ (as said, iâ€™m not a math proâ€¦ â€śsimpleâ€ť situation > stupid solutions).

The first step would be to interpolate through your samples, â€śsubsamplingâ€ť, making a more dense (increased number of samples) but equally spaced grid.
I would do 2 surface with â€śpatch surfaceâ€ť, one for XZ curvatures/tangentvectorangle and another for YZâ€¦ smoothing the Z values.
But Iâ€™m not sure if â€śsplittingâ€ť the curvatures into 2 â€śderivative graphsâ€ť would broke the total smoothness.
(hence why an ideal solution â€śwould beâ€ť a 4-D derivative graph")

I donâ€™t know.
Maybe iâ€™m completely off road, googling the right keywords might lead us to proper solutionâ€¦ but i donâ€™t know what to search for.
Iâ€™m just writing what I have in mindâ€¦ madness atm.

Hi again

just so you know what I am doing:

I am trying to recreate this (of course in a simpler version and not as acurat)

page 4/5 is the steps I am going through right now.

progress of mine so far:

1 Like

Yes, I remember your previous posts.

What you have are samples of a possible â€śnormal mapâ€ť
1st result googling â€śreconstruct from normal mapâ€ť:

Beware:
Your calculations are done (probably) using distance as your â€ślensâ€ť is flat, like a fresnel lens.
After you have your first shape, you will likely need to re-iterate through it doing again your math but with new distances (some parts of the lens are nearer the object and further from projection panel and vice-versa), and so the ray angles will change a bit (becoming more precise).
Or, you know, find a direct math calculation.

surface_integral_V0.5.gh (51.4 KB)

This solution can somehow â€śinterpolateâ€ť through uneven located 3d-vectors.
Itâ€™s heavy and very likely imprecise and wrong, probably wasted time.
You need a math expert to do what you need.

Anyway, in my solution i make 3 patch surface through 3 different sets of points.
Each set is made by moving in Z the sample point by the component of its vector (X, Y, Z â€¦ hence 3 sets)
Then intersecting the surfaces with a grid of rays and reconstructing the vectors to have the even field.

(inside is a c# to extend surfaces and a c# to convert vector to normal color)

How to do the next step, from vector to 3d shape, is still a mystery to me.
(but, as said, the first step is already â€śfakeâ€ťâ€¦ soâ€¦)

2 Likes

just thought of a whole nother problem ^^ that I didnâ€™t consider at all uptill now. although it is quite obvious

this project is slowly getting out of hand so many mathematical things to concider. but who doesnâ€™t like a challange

I re-quote myself:
â€śYour calculations are done (probably) using distance as your â€ślensâ€ť is flat, like a fresnel lens.
After you have your first shape, you will likely need to re-iterate through it doing again your math but with new distances (some parts of the lens are nearer the object and further from projection panel and vice-versa), and so the ray angles will change a bit (becoming more precise)â€¦â€ť

I like challenges, indeed.
But Iâ€™m missing knowledge (as always), and the empiric methods I use not always get to a result.

(another thing, the Olympic logo in your sources have creases dividing the colors; those are like different lens shapes joined togetherâ€¦ what are we doing here is just 1 lens. Your refraction lens will not have â€ścreasesâ€ťâ€¦ or, it could have them, but with a very high sample resolutionâ€¦ which is madness!)

1 Like

ah now I understand what you ment. sorry I didnâ€™t quite get that

with

I didnâ€™t mean you but me and not giving up on my goal ^^

yeah I know

One of my friends is a math student. I will try and see if he can make time for me. If he does and I get to a â€śsolutionâ€ť or rather a approximation that works close enough, I will post it here for anyone who is interested

WIP update

Interpolation between points was unreliable (patch would take unpredictable shapes)
Needing another method to â€śinterpolateâ€ť between a set of 2D-random-placed values, I switched to using mesh-spray functions.

I try to describe now shortly the process:

• I created a set of points (flat, Z=0) , each with its normal vector. In the script I used a semi-sphere as a source.
• Done delaunay mesh from those points + some far point to get a large, extended mesh
• Converted normal vectors to normal colors and colored the mesh with spray points
• evaluated the mesh with a high-resolution grid of samples to get an even distributed matrix of color samples
• converted color to vector back again

From now on the method is likely to be inaccurate/wrong/incomplete
(or maybe iâ€™m just lacking enough resolution, the 2D version was fine ONLY with very high resolution)

• we have a matrix of vector samples to use for moving the matrix of point
• for each row, starting from first point (still), calculated final Z for each element as the sum of the â€śsteepâ€ť (tangency) of all previous element
• same for each column
• for each point in the matrix, done the average (of Zs) from row and column results

surface_integral_V0.7.gh (51.4 KB)

Visual result:

Starting from top:

• theoretical perfect result (just getting correct info from the semi-sphere)
• semi-sphere used to get initial samples, vector + point (projected to Z0)
• final result
• interpolated mesh from high resolution sub-samples (from top it looks the same as the sphere - good!)
• large low resolution mesh from original starting uneven samples (+ visible vectors)

I tried an very high resolution, but after some time i just killed rhinoâ€¦
I donâ€™t know how to go on further than this.

This is semi-heuristic , no (complex) math involved â€¦ result: meh.

1 Like

Hi
I wouldnâ€™t call the result meh
To be honest this is better than anything I even got too (by far )

Maybe not the 100% correct way mathematically, but I think that you have had to study math to be able to complete solve this issue

I will try this solution tomorrow (from front to back -> taking an image sampling it to define where light rays need to go and calculating vektors | then your script) and then render a caustic image from the generated geometry and see how it looks. Will post image here

best regards
chris

hi
sorry it took me for ever to get back to you.
well better late than never
I tried it with one of my results of planes and plane normals. As you expected the result are by far not as good as what you got with your sphere example. but there you had one continous motion of vektors and not a wild something like me now
here is what it looks like when i try inputting my planes:

the vectors vary to much for it to be a smooth surface
hm what to do now? I donâ€™t know either ^^

But again so thanksfull for your effort

oh yeah. incase you are interested
i also managed to achive this (with some help )

i moved each plane on the zaxis to match up with its neighbor on a row by row basis. and then reoriented the the plane to still have the correct refraction of light.
also still not the results i was going for, but ^^ Donâ€™t really want to give up