Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void getPoints(int x0, int y0, int radius, int noOfDividingPoints, Canvas canvas) {
- double angle = 0;
- x = new int[noOfDividingPoints];
- y = new int[noOfDividingPoints];
- for (int i = 0; i < noOfDividingPoints; i++) {
- angle = i * (360 / noOfDividingPoints);
- x[i] = (int) (x0 + radius * Math.cos(Math.toRadians(angle)));
- y[i] = (int) (y0 + radius * Math.sin(Math.toRadians(angle)));
- }
- for (int i = 0; i < noOfDividingPoints; i++) {
- Log.v("x", "" + i + ": " + x[i]);
- Log.v("y", "" + i + ": " + y[i]);
- divideLineIntoEqualParts(x0,y0,x[i],y[i]); // code to divide lines into different points
- if(inte < listOfPoints.size()){
- mPath.moveTo(listOfPoints.get(0).x, listOfPoints.get(0).y);
- mPath.quadTo(listOfPoints.get(0).x, listOfPoints.get(0).y, listOfPoints.get(inte).x,listOfPoints.get(inte).y);
- canvas.drawPath(mPath, getDashLine());
- inte++;
- }
- }
- }
- private void divideLineIntoEqualParts(int x1,int y1,int xx,int yy) {
- listOfPoints.clear();
- for (int k = 1; k <= 50; k++) {
- listOfPoints.add(new PointF(x1 + ((k * (xx - x1)) / 50),y1 + (k * (yy - y1)) / 50));
- }
- Log.d("listOfPoints : size : ",listOfPoints.size()+"");
- }
Add Comment
Please, Sign In to add comment