How can I convert an area into a variable?

Cecilia Lucía Gigena shared this question 2 years ago

I have 2 triangles and I have used the Area function.



When I change the position of point B, triangle 1 disappears and triangle 2 shows up.

I want a text that says: area triangle = ...

And it has to tell t1 or t2 depending on which of those is shown.

So I want a number with if condition, that equals t1 or t2 depending on conditions to show triangle - and then use that number in the area text.

I tried e = t1 and nothing happens - it does not recognize I am refering to that area.

Comments (1)


Maybe it's better to define just one triangle and just one rectange both conditionally according to y(B). You could do:

rect=Si(y(B) < y(A), Polígono(E, G, B, C), Polígono(E, A, D, C))

trian=Si(y(B) > y(A), Polígono(A, B, D), Polígono(A, B, G))

Doing so the rectangle and triangle are always defined, so you don't have any problem in your text referring to them.


Files: area.ggb
© 2023 International GeoGebra Institute