Notifications
Clear all

[Closed] inverted archs

On the left are the two arcs being created at [0,0,0]
To the right are two different examples of what the end result could look like.

How do I find the direction ‘normal’ of the last two points in the green arc? Then use that normal to place the yellow arc’s points?


(
	delete objects
	local columns = 9
	local steps = 3
	local origin = [0,0,0]
	local allArchs = #()
	
	/*Set Vertices*/
	for s = 1 to steps do
	(
		local columnAngle = (random 45.0 180.0) / (columns-1)
		local radius = random 5.0 10.0
		local col = random [150,150,150] [255,255,255]
		local archArr = #()
		
		for v = 1 to columns do
		(									
			calcX = radius * cos((v-1) * columnAngle)
			calcY = radius * sin((v-1)* columnAngle)
			
			pos = [0,calcX,calcY]--include nodes matrix
			
			if v == 1 do origin = [0,0,0] - pos
				
			setPos = pos + origin
			
			p = point pos:setPos size:2 wirecolor:col
			append archArr p
		)
		append allArchs archArr
	)
	
)

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

I not understand your question.
To get direction of las two points:
a – last point
b – second last
dir = normalize (a-b)
tm = matrixFromNormal dir

This shall help.

So on the left is the shape I’d like to create at the start.
It is essentially a spiral but in segments
Green – radius of 20
Yellow – radius of 15
Red – radius of 10

On the right I took each group and rotated them on the local Y axis a random 90 degrees.

Page 2 / 2