Is there any method to get x and y axis value of a 2D shape (i.e. a circle or rectangle)? I haven’t found any related reference.
well you can always draw a rectangle, but for a circle, given the angle and radius, you can calculate the position with
float x = CenterCricleX + cos(angle)*radius; float y = CenterCircleY + sin(angle)*radius
What do you mean by “getting the x and y axis value of a 2d shape”?
This question is vague. A shape fills a space, sure in coding terms it has an x and y, but its difficult to understand what is meant by get x and y.
If youve drawn the shape then your program should already have location details. If youre talking about testing collisions and seeing if x and y are inside a shape thats different.
If you want the midpoint of a shape again that might be different depending on the draw mode.
Pleaze specify what is required
Check put the references, examples and tutorials here:
Use the search bar on the Processing website to search the site:
Start with circle and rectangle.
Be sure to read the entire reference and the related items at the bottom.