Jump to content

Best way to rotate around a circle...


Recommended Posts

so I'm working on a plugin that creates a symbol and then rotates it based on a degree making a consistent curve. i've gotten a version working but only if i know the diameter of the circle the curve is based on... my question is if the user puts in a angle of 6 how do i dynamically find where to rotate the symbol from? 

 

heres a code used to make what I'm looking for. this picture is based off already knowing the size of the circle... i've also attached a picture of what I'm trying to achieve. 

 

 

tile = "Symbol-1"
cur_width = 0
cur_angle = 10
vs.DSelectAll()

for i in range(10):
	vs.Symbol(tile, -9.842519685, 1.289, 0)
	last = vs.LNewObj()
	vs.RotatePoint(0, 109.921, cur_angle)
	vs.Move3DObj(last, 0, 0, 0)

	cur_width = cur_width + 19.68503937
	cur_angle = cur_angle + 10
	vs.DSelectAll()

 

Screen Shot 2021-08-03 at 10.30.04 PM.png

Link to comment
3 hours ago, Pat Stanford said:

Just an angle is not enough information. You need to have some other piece of information to calculate where the center of rotation should be.

 

What about putting a Control Point that the user can move to define the center of rotation?

hmm sadly thats not really an option... this is for a curved wall feature I'm adding to my LED Wall plugin and the only interaction the user will have is a parameter field that they input an integer into.

Link to comment

If you are using VW curved walls, then you should be able to get the CenterX and CenterY and Radius or Diameter that are displayed in the OIP

 

If you are not using VW curved walls you probably need to attach a record to the curve when you create it to specify how you calculated it that you can recall to give you the information you need.

Link to comment

ok so i had to look at it again because i was starting to confuse myself... what i ultimately need is not really VW related but math related... lol 

 

if i have a known constant of 10 degrees and i know the object I'm trying to rotate is 500mm wide or 19.68503937 inches (because plugins only work in inches...) how do i find out where to place the pivot point of the imaginary circle these are moving around.

Screen Shot 2021-08-04 at 9.01.43 PM.png

Link to comment

Do you know where the first object is? Do you know that the object has a width of 10°?

 

If so, then the object is effectively the chord across the 10° section of the curve. The center of the circle will lie on a perpendicular line from the midpoint of the chord.  It sounds like you still do not have enough information to do the math. as you need at least three points on the circle (arc) to find the center.

 

These two sites offer more information about finding the center of a circle based on an arc segment.

 

https://math.stackexchange.com/questions/1113276/how-to-find-center-of-a-circle-from-only-an-arbitary-arc-of-that-circle

 

https://en.wikipedia.org/wiki/Thales's_theorem#mediaviewer/File:Thales'_Theorem_Simple.svg

  • Like 1
Link to comment

ok i've made some great progress! 🙂  I'm using vs.Line(), vs.LineLineIntersection(), and some math to draw 2 lines and get the pivot point of the arc. its close but still has some issues...

 

the main issues I'm having is vs.RotatePoint() only seems to be working if I'm in a top view... if i have any offset angle (using the flyover tool) it seems to follow the way the camera is pointed....

 

I'm also having some weird issues when curving negative but i think that has to do with the symbol I'm using.

Link to comment

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.   Restore formatting

  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...