Question: geometry:-area() function issue

Hello!

Using a geometry package, I ran into a problem: the area() function returns the wrong value for square elements.

What am I doing wrong?

_local(D)

with(geometry)

b := 2

h := 1

square(sq1, [point(A, 0, 0), point(B, b, 0), point(C, b, h), point(D, 0, h)])

evalf(area(sq1))

2.500000000

(1)

draw([sq1, A(printtext = true), B(printtext = true), C(printtext = true), D(printtext = true)])

 

triangle(tr1, [point(A, 0, 0), point(B, b, 0), point(C, b, h)])

evalf(area(tr1))

1.

(2)

draw([tr1, A(printtext = true), B(printtext = true), C(printtext = true)])

 

NULLNULL

NULL

b := .1

h := 1

square(sq2, [point(A, 0, 0), point(B, b, 0), point(C, b, h), point(D, 0, h)])

evalf(area(sq2))

.5050000000

(3)

draw([sq2, A(printtext = true), B(printtext = true), C(printtext = true), D(printtext = true)])

 

triangle(tr2, [point(A, 0, 0), point(B, b, 0), point(C, b, h)])

evalf(area(tr2))

0.5000000000e-1

(4)

draw([tr2, A(printtext = true), B(printtext = true), C(printtext = true)])

 

``


 

Download GeometryAreaTest.mw

Please Wait...