Jump to content

Recommended Posts

Hey,
 

I am trying to reproduce this kind of structure that we can see on this website : http://acme-experience.com/ (under the menu in the bottom left corner).

So far I manage to create polylines between points of a grid (pic. 2). But I think this is not the way to go for this effect. Because my polylines have always the same size and they don't seems to come from the center to the outer as much as in the example.

I am not so far though but if u have any idea on how I could improve it let me know I am stuck since a day on it...

You can find my project file linked if it is helpful.

Thank you for reading, 

And as always take care

2020-04-06 15_30_16-Window.png

drawRectLines.hip

2020-04-06 15_34_10-Window.png

Link to comment
Share on other sites

node = hou.pwd()
geo = node.geometry()

# Create Variables.
iterations = node.parm("iterations").eval()
originx = float(node.parm("originx").eval())
originy = float(node.parm("originy").eval())
point1x = float(node.parm("point1x").eval())
point1y = float(node.parm("point1y").eval())
point2x = float(node.parm("point2x").eval())
point2y = float(node.parm("point2y").eval())

# Import math for the hilbert function
import sys, math

# Create the class that does the heavy lifting for the Hilbert Curve
class Hilbert:
    # Recieve the variables from Hilbertclass
    def __init__(self, x0, y0, xi, xj, yi, yj, n):
        # Send variables to hilbert function for math to be done
        self.hilbert(x0, y0, xi, xj, yi, yj, n)
    def hilbert(self, x0, y0, xi, xj, yi, yj, n):
        if n <= 0:
            X = x0 + (xi + yi)/2
            Y = y0 + (xj + yj)/2
            point = [X, Y, 0]
            # Send data to data, which whill pass it back to Hilbertclass
            self.data(point)
        else:
            # The fancy math. Thank you Malcolm Kesson!
            self.hilbert(x0,               y0,               yi/2, yj/2, xi/2, xj/2, n - 1)
            self.hilbert(x0 + xi/2,        y0 + xj/2,        xi/2, xj/2, yi/2, yj/2, n - 1)
            self.hilbert(x0 + xi/2 + yi/2, y0 + xj/2 + yj/2, xi/2, xj/2, yi/2, yj/2, n - 1)
            self.hilbert(x0 + xi/2 + yi,   y0 + xj/2 + yj,  -yi/2,-yj/2,-xi/2,-xj/2, n - 1)
    def data(self, point):
        # Pass data back to Hilbertclass
        pass
		
# This is the class that creates the points for the Hilbert Curve
class Hilbertclass(Hilbert):
    def __init__(self, x0, y0, xi, xj, yi, yj, n):
        # Give the input data to the base class
        Hilbert.__init__(self, x0, y0, xi, xj, yi, yj, n)
    def data(self, point):
        # Create the point
        curve = geo.createPoint()
        # Set the position of the point
        curve.setPosition(point)
        # Add this newly set point to the polygon
        poly.addVertex(curve)

# Create a Polygon to hold the vertex data
poly = geo.createPolygon()
# Set the polygon to be open so it acts like a line
polygon = poly.setIsClosed(False)
# Call Hilbertclass to begin all the procedures
Hilbertclass(originx,originy, point1x,point1y,point2x,point2y, iterations)

plus you have L-system that you can have more fun

 

gtL.png

 

tutorials.cgrecord.net/2016/12/vex-in-houdini-space-filling-curves.html

Edited by Librarian
  • Like 1
Link to comment
Share on other sites

Hey thank you very much for your reply,

This look really cool, however I have to say this is too advanced stuff for me. But I will surely try to dive deeper on it once in a while. Maybe I am just trying to do something too complicated for my current skills... 

Thank you again for sharing this which look tremendous! 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...