The new version of Grasshopper has overwritable variables. First, all the constants (e, pi, phi etc.) are declared, but if you then decide to use a variable of your own called e, pi or phi, the value will replace the constant.
Hello Vicente!
Could you explain how to create math surfaces using functions components if I have a function expression.
I take the math function expressions from Wolfram's website and write them inside of a GH function component. But have no idea how to proceed. What components do I need to input/output to a function component?
Hi,
First you need to know the parametric equations and the uv domain you want to represent.
For example, i want to create an Enneper surface, i know the parametric equations are:
x = u*cos(v)-u^3/3*cos(3*v)
y = u^2*cos(2*v)
z = -u*sin(v)-u^(3)/3*sin(3*v)
and the domain i want to display is:
u: 0 to 1
v: -PI to PI
One way of creating this surface would be like this:
The expression component must be set to "cross-reference".
Although it doesn't look pretty, to simplify the definition i concatenated the 3 equations using the syntax to create directly a point from an expression component, this is "{x,y,z}".
Vicente,
Thanks a lot for your explanation.
I haven't got the logic of building that kind of definition.
Why do we need the Addition component?
Why did you input 20 to the Range components?
Why did you input 1 to the Addition component?
What if I don't have u and v variables but have only x, y, and z variables like in a Schwarz IsoSurface:
-(cos(x)+cos(y)+cos(z))
where x: -4 to 4,
y: -4 to 4,
z: -4 to 4.
What the definition does is to create a grid of points in 3d space that corresponds to the shape of the surface, then i interpolate a surface through these points.
20 is the resolution of the surface. If i divide an interval in 20 steps, i end up with 21 numbers, so i'm creating a grid of points that consists of 21 x 21 points. Since the surface component asks for the number of points in the U direction, i get the number "20" and add 1 to end up with 21.
If you want to create an isosurface, it's not as easy since the points can't be arranged into a grid. You can display the boundary points of the surface easily but to create actual geometry you need something like a marching cubes algorithm. I did a definition for it but it works really slow. An alternative can be to bake the points and use rhino's mesh from points command.
Here is a definition I made awhile back to make several common parametric surfaces. It is of course quite similar to the one Vicente made. Many paths to the same goal!