Android Open Source - NotATop Circle From Project Back to project page NotATop .
License The source code is released under:
GNU General Public License
If you think the Android project NotATop listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code package com.gg.util;
/ * f r o m w w w . j a v a 2 s . c o m * /
/* ??????????? */
public class Circle {
private Point center;
private float radius;
public Circle(Point center, float r){
this.center = center;
radius = r;
}
public Circle(float x, float y, float r){
//this(new Point(x, y), r);
center = new Point(x, y, 0);
radius = r;
}
public Point getCenter() {
return center;
}
public void setCenter(Point center) {
this.center = center;
}
public float getRadius() {
return radius;
}
public void setRadius(float radius) {
this.radius = radius;
}
public boolean isCollideRectangle(float x1, float y1, float x2, float y2){
if (center.y-radius <= y1){
return true;
}
if (center.y+radius >= y2){
return true;
}
if (center.x-radius <= x1){
return true;
}
if (center.x+radius >= x2){
return true;
}
return false;
}
public boolean isCollideCircle(Circle circle){
float x1 = center.x;
float y1 = center.y;
float x2 = circle.center.x;
float y2 = circle.center.y;
float distance = (float ) Math.sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1));
if (distance<=radius+circle.radius){
return true;
}else {
return false;
}
}
}
Java Source Code List com.gg.game.ClassicGame.java com.gg.game.ClassicGame.java com.gg.game.GameFrame.java com.gg.game.GameFrame.java com.gg.game.TimeGame.java com.gg.game.TimeGame.java com.gg.module.DrawBackground.java com.gg.module.DrawBackground.java com.gg.module.DrawScore.java com.gg.module.DrawScore.java com.gg.module.DrawTrack.java com.gg.module.DrawTrack.java com.gg.module.SelectControl.java com.gg.module.SelectControl.java com.gg.module.SoundControl.java com.gg.module.SoundControl.java com.gg.module.VoiceControl.java com.gg.module.VoiceControl.java com.gg.top.BasicTop.java com.gg.top.BasicTop.java com.gg.top.DrawCircle.java com.gg.top.DrawCircle.java com.gg.top.DrawCone.java com.gg.top.DrawCone.java com.gg.top.DrawCylinder.java com.gg.top.DrawCylinder.java com.gg.top.DrawTop.java com.gg.top.DrawTop.java com.gg.util.Circle.java com.gg.util.Circle.java com.gg.util.Constant.java com.gg.util.Constant.java com.gg.util.DateUtil.java com.gg.util.DateUtil.java com.gg.util.Direction.java com.gg.util.Direction.java com.gg.util.Line.java com.gg.util.Line.java com.gg.util.Point.java com.gg.util.Point.java com.gg.util.TextureRect.java com.gg.util.TextureRect.java com.gg.util.TrackPoint.java com.gg.util.TrackPoint.java com.gg.util.Track.java com.gg.util.Track.java com.gg.util.Utils.java com.gg.util.Utils.java com.gg.view.ClassicGameSurfaceView.java com.gg.view.ClassicGameSurfaceView.java com.gg.view.EndSurfaceView.java com.gg.view.EndSurfaceView.java com.gg.view.FirstTimeSurfaceView.java com.gg.view.FirstTimeSurfaceView.java com.gg.view.GameModeSurfaceView.java com.gg.view.GameModeSurfaceView.java com.gg.view.HelpSurfaceView.java com.gg.view.HelpSurfaceView.java com.gg.view.MainActivity.java com.gg.view.MainActivity.java com.gg.view.MainMenuSurfaceView.java com.gg.view.MainMenuSurfaceView.java com.gg.view.ScoreSurfaceView.java com.gg.view.ScoreSurfaceView.java com.gg.view.SelectSurfaceView.java com.gg.view.SelectSurfaceView.java com.gg.view.SurfaceViewFactory.java com.gg.view.SurfaceViewFactory.java com.gg.view.TimeGameSurfaceView.java com.gg.view.TimeGameSurfaceView.java com.gg.view.WelcomeSurfaceView.java com.gg.view.WelcomeSurfaceView.java