encapsulation of a point in two-dimensional Cartesian space

Asked

Viewed 182 times

2

I created a class ponto2d with the x and y attributes, I created the get and set methods, until ai blz, then created a class retângulo with width and height, I need to know the value of a point in two-dimensional Cartesian space.inserir a descrição da imagem aqui

  • 3

    Prefer to copy and paste the code. It is much more readable. Also, the question was not very clear. Can you explain better? (editing the post)

  • What you call the "point value" for the purpose of this question?

1 answer

1

From what I understand, your own class is a POJO, that is, it is a class that we use to carry data from one method to another, and instead of spending all the time X and Y, passing only its class ponto2d as a parameter.

A good basis is class Point2d of the JDK itself: it itself represents a point and is used as the basis value for a Cartesian point by other geometry classes.

That is, if you have a triangle, you will have 3 objects point2d to represent the Cartesian points.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.