Reputation: 2344
I am using UnfoldingMap library. I have created a map and few markers. I want to show a circle around the marker. I am using the given code where x and y are coordinates and radius is radius in km. Ya I know I can't use km radius directly I have to convert it into pixels. How to do this conversion ?
public void showImpactCircle(PGraphics pg, float x, float y, float radius)
{
pg.fill(255,0,0,60.8f);
pg.ellipse(x, y,2*radius, 2*radius);
}
Upvotes: 3
Views: 206
Reputation: 295
According to Processing library reference page : ellipse(): "Draws an ellipse (oval) to the screen. An ellipse with equal width and height is a circle. By default, the first two parameters set the location, and the third and fourth parameters set the shape's width and height. The origin may be changed with the ellipseMode() function."
Syntax
ellipse(a, b, c, d)
Parameters
a float: x-coordinate of the ellipse
b float: y-coordinate of the ellipse
c float: width of the ellipse by default
d float: height of the ellipse by default
So, c and d parameters are not radius but actually width and height of ellipse. And according to your question I assume you want to assume that you want to scale. Please see : https://processing.org/reference/ellipse_.html
Upvotes: 0