Distance from point to object

IBM42 shared this problem 5 years ago
Solved

Using

GeGebra


(GeoGebra 5.0.269.0-3D (Java 1.7.0_40-32bit, 247MB, Giac/JNI) 19

August 2016


)


Let A=(4,0,0), B=(0,4,0), C=(-4,0,0), D=(0,-4,0) and E=(0,0,4)


F=Polygon[A,B,C,D]


Using the command


dist=Afstand[E,F] (measuring the distance between point and

object) I get:


dist=4.9


Is this an error or a feature? I would say the distance is 4.0


yours


Ib Michelsen

Comments (5)

photo
1

The Polygon F is different from the whole plane with the points A, B, C and D!

I think, your distance 4.9 is the distance between point E and its nearest point in F.

photo
1

The nearest point in F is O=(0,0,0)

The distance between E and O is exctly 4

photo
1

I see my error. Trying some things I figured out, that 4.9 (better: 4.898979) ist the distance between E and the midpoint of one of the polygons sides.

photo
1

hello

the distance is at a point in perimeter of polygon


but there is a bug. create in 3Dgraphics several points in a circle centered in (0,0) and the polygon and a point in zAxis then define distance this last point to polygon. the result is the distance to a vertex

if the vertexes of polygon have different distences to last point then is correct


saludos

photo
1

If you want to get the distance to closest point inside the polygon, try

Distance[ClosestPointRegion[F, E],E]

to get distance to the plane of the polygon you can use

Distance[Plane[F],E]

If you use just Distance[F,E] it should do the same as Distance[ClosestPoint[F, E],E] where ClosestPoint refers to the boundary, not the region.

EDIT @mathmagic thanks, managed to reproduce and fix the bug (happens with 2D vertices of the polygon).

Cheers,

Zbynek

© 2022 International GeoGebra Institute