Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating animation of changing radius. #3

Open
alexd555 opened this issue Apr 5, 2019 · 0 comments
Open

Creating animation of changing radius. #3

alexd555 opened this issue Apr 5, 2019 · 0 comments

Comments

@alexd555
Copy link

alexd555 commented Apr 5, 2019

Hi,

I want to change radius online and then I use with setHoles.
But signature of this function is List<? extends List>

I tried it:
private static List<? extends List> createHole2(LatLng center, float radius) {
int points = 50; // number of corners of inscribed polygon

    double radiusLatitude = Math.toDegrees(radius / (float) EARTH_RADIUS);
    double radiusLongitude = radiusLatitude / Math.cos(Math.toRadians(center.latitude));

    List<? extends List<LatLng>> result = new ArrayList<>(points);

    double anglePerCircleRegion = 2 * Math.PI / points;

    for (int i = 0; i < points; i++) {
        double theta = i * anglePerCircleRegion;
        double latitude = center.latitude + (radiusLatitude * Math.sin(theta));
        double longitude = center.longitude + (radiusLongitude * Math.cos(theta));
        List <LatLng> l = new ArrayList<>();

        l.add(new LatLng(latitude, longitude));
        result.add(l);
    }

    return result;
}

But I got error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant