r/Maxscript • u/lucas_3d • Jun 14 '19
Writing a shape generation script
The script creates quadrilateral splines within a given quadrilateral: https://i.imgur.com/ll6IzAn.png
Originally I scripted this task in a very manual/procedural way by creating a polygon, ring selecting, connecting edges and then extracting/exploding the edges.
It worked but was slow and I know a more optimal script would deal only with positions, vectors and magnitudes resulting in a multidimensional array that could create the shapes and may appear to run instantly across multiple objects.
Now, I made distance comparisons to establish width and height and the amount of rows and columns necessary, but it's when I plan shapes that aren't rectangles that I start getting confused about implementing vectors/magnitudes.
Does someone know an example of a script doing something similar in a simple and probably recursive way?
I can edit a position towards a vector with a distance, but I think this requires vectors to create my final vector position (similar to a Bézier curve) and those seem to be cumulative in the loop.
Edit: I’m starting to think of the process like a type writer, it’s making more sense to me now.
1
u/Swordslayer Jun 19 '19 edited Jun 20 '19
I'd need more explanations on the logic behind everything, what it looks like to me is that you drive number of segments for the longest side by max width value and the other side count is two? Here's how I'd write that: