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.
View all comments
Show parent comment
1
u/lucas_3d Jun 19 '19 edited Jun 19 '19
Here it is partially written out, it does run really quickly!:
https://i.imgur.com/v1r52KQ.gif
https://pastebin.com/raw/tZeA5b3s
Unfortunately I run row1 then row2, I'd like to write just the one operation with the column and row code to take care of it.
Is the 'unit vector' way that I have written this misguided??