cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

24-Ruby IV

## Distance between a point and a square, triangle etc

I have a function for the calculation the distance between a point and a square.

My questions:

0. Do you know some references on this topic - an ellipse with not point-focuses but with circles etc?

1. Can the function Square be mote simple?

2. I need one more argument for the function Square - an angle alpha - the rotation of the square from 0 to 90 deg.

3. Help me to create the function Triangle (Rhombus, Rectangle, Ellipse, etc.) with same properties!

I need it for this... art

8 REPLIES 8

Not an exact solution, but this is close.  I divide each line into segments and pick the closest of all the points. 4.0 and pdf attached.

24-Ruby IV
(To:DJF)

Thanks DJF!

I will try to convert your solution to MC15 and create the function Square(x, y, alpha, p, xs, ys).

The function without alpha:

24-Ruby IV
(To:ValeryOchkov)

One simple example - a vertical offcut.

Wee need an angle alpha in the function OffCut!

24-Ruby IV
(To:ValeryOchkov)

See one animation of new Ellipse

24-Ruby IV
(To:ValeryOchkov)
24-Ruby IV
(To:ValeryOchkov)

A equilateral triangle

24-Ruby IV
(To:ValeryOchkov)

More correct function and animation:

24-Ruby IV
(To:ValeryOchkov)

An Ellipse with a circle, a square and a triangle as focuses:

Announcements
Top Tags