Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5871

Finding Angle of Rotation on Randomly Rotated Shape

$
0
0

@woxxy wrote:

Hi there everyone :slight_smile:

So to preface I'm working entirely within RhinoPython and I'm attempting to align custom created randomly rotated shapes. To do this I'm trying to calculate the angle of rotation. One method I've been trying to implement involves; calculating the centroid of an object, then finding the point furthest from the centroid and using those two points to calculate the angle. But as of yet I haven't been able to find a way to access the points of the custom shape (without resorting to RhinoScript to get them).

For testing I'm using the AddRectangle() method to create a shape of random size.

e.g. rs.AddRectangle(plane, size, size * 3) // Size being a random int

I would then add a planar surface to the shape and calculate the surface's centroid.

But then I hit a snag in attempting to calculate a point to use to calculate the angle of rotation. I've done exhaustive research trying to find a function or anything to help me access the attributes of the rectangle or find the point through some other means but I've come up dry.

I'm not sure if my logic is incorrect or I've overlooked some function that has done exactly what I'm wanting. If anyone would help me get on the right path with this, it would be greatly appreciated! :slight_smile:

Cheers!

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5871

Trending Articles