Created
January 17, 2021 10:47
-
-
Save raghunandankavi2010/b16d5f1d2c757e0b8335c03600f0b59d to your computer and use it in GitHub Desktop.
Drawing ticks on circle circumference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int i = 0; i < TICK_COUNT; i++) { | |
float startAngle = (float) Math.toRadians(0f); | |
float angle = (float) ((startAngle + i) * (Math.toRadians(360)/TICK_COUNT));// * (Math.PI / TICK_COUNT)); | |
int x = (int) ((radius* Math.cos(angle))+ cx); | |
int y = (int) ((radius* Math.sin(angle)) + cy); | |
int x1 = (int) (((radius+20)* Math.cos(angle))+ cx); | |
int y1= (int) (((radius+20)* Math.sin(angle)) + cy); | |
canvas.drawLine( | |
x, | |
y, | |
x1, | |
y1, | |
mTickPaint | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment