# Rotate deformed ellipse to x ortho

#1

I’m new to grasshopper.
Sulution should rotate long axis of deformed ellipse to x ortho, from any quadrent of world plane.
I’m working on this sulution and am not sure if the “Find the first Domain” will find the sum of the domain or just any numbers in this list. Or if it matters to the result. Also would like to know if I even need ot use Grasshopper.

I digitize oval vanity sinks and then produce granite counter with them.
Curently I guess at the center line.

To test or help me.
SquishEllips.3dm (8.5 MB)

OrthoOval.gh (6.5 KB)

#2

“Solution”.

(deleted erroneous solutions)

P.S. I don’t understand yet why it doesn’t work measuring the angle to a ‘Y’ vector as it does to ‘X’?

OK, finally solved that mystery, which yields this slightly simpler solution that works with either ‘X’ or ‘Y’ vector as a reference (results are different by 90 degrees). What I missed was providing the ‘P’ (Plane) input to Angle for measuring the angle between two vectors.

OrthoOval_2018Feb18c.gh (14.8 KB) (geometry internalized, no need for Rhino file)

#3

Thank you for the quick response.
I have no idea how this works.(will try to learn), but will put it to work Monday.
Not going to quit my day job for writing grasshopper.
Is there a command in Rhino that will do this? Not that I need it now. Just asking.

#4

Look again as I fixed an error; use version ‘c’. What this does is use the start/end point and the midpoint of each ellipse to define a vector, then measures the angle of that vector compared to unit ‘X’ or ‘Y’ and rotates each ellipse by that angle.

I wouldn’t know. GH is very good for this sort of thing.

#5

The start point may not be at the major axis point. The deformed ellipse is digiized. (Arbritary) So if the start point was know I wouldn’t need to do this. The start/end point could be any point of the curve. My 3dm file should have included digitized sinks to show this. Sorry. My thought now would be to rotate the furthest points of any object to X axis ortho. This is why I thought of a bounding box to start with. Version ‘c’ was not inlcuded in post.

Typical digitized sink… K-2210. I use this 100’s of times of month. Is it on ortho?
typicalSinkInput.3dm (8.7 MB)

#6

Hah, hah! So the game here is to determine the major axis of an arbitrary deformed ellipse? Funny. The first question is how did that information get lost? Second question is why did my method work so well on your first set of ellipses? How were those curves formed from digitized data?

#7

My first post as evolved into the question “determine the major axis of an arbitrary deformed ellipse”. I didn’t know this was my question. Thank you.
My first file only included mirrored quadrents of a deformed ellipse that I was working on to clean up my digitized sinks. (Long project of 7 years of nasty digtized sinks).
This file mislead you into thinking of perfect geometry. Not the case from me. If I see 90.00 deg. corner, perfect circle, or 45 deg corner, I see false/not realistic. (Included start/stop @ ortho).

#8

This version divides each ellipse into the slider ‘Count’ * 2 points and sorts to find the pair of opposite points with maximum distance between them, which is the major axis. For better resolution, just increase the maximum limit of the ‘Count’ slider.

OrthoOval_2018Feb18d.gh (23.9 KB)

#9

I’m sure there are many ways to skin this cat.
One of my first questions is will “Find the first Domain” find the sum of domain or just any number in this list. And will the result matter in the result?
I don’t want to make this to complicated…Find longest x from list of bounding boxes.
Return result. draw curve.

#10

BBox is useless here since there is no way to orient them. I gave you my best answer. Are you now suggesting you want to redraw these “deformed” ellipses instead of rotate them?

Oh, now I see what you’re trying to do… I think Sort is a better solution, but whatever works for you. The yellow and blue groups do the same thing:

Why “299”? 180 should be enough?

#11

BBox is useless here since there is no way to orient them. I gave you my best answer. Are you now suggesting you want to redraw these “deformed” ellipses instead of rotate them? Blockquote

BBox was the way I used to find the longest point. Not knowing another way. I then use the lndex from the bounding box for the index of the deformed ellipse for tranformation(rotation).
Is there a difference in redraw and rotate? I thought transformation of any type would need to be baked back into Rhino.
I’m here to learn and I am thankful for your responses. Still tying to understand your files. Just a “old bricklayer here”.

#12

I’m grateful to you for posting code and geometry with your question. Thank you. Your solution is fine, though mine is potentially higher resolution (more accurate) because I sample/test more points/angles based on the ‘Count’ slider.

#13

On second thought… I didn’t really answer these questions and really don’t know why FDom (Find Domain) works in your solution, since none of the domains contain the value “10000”? It took me awhile to grasp what you were doing and when I did, I leaped to the Sort distance solution (blue group) to find the largest X dimension value, which agreed with your result.

OH! Now I see it. Instead of the FDom ‘I’ (Index) output (which is “-1”), you used ‘N’ (Neighbour), which returns “Index of domain that is closest to the specified value”. Very tricky! Not always easy to grasp a different point of view. Still not how I would do it, for both precision and performance reasons, but it works.

OrthoOval_2018Feb18e.gh (17.7 KB)