Добавлена функция проверки принадлежности точки к окружности
This commit is contained in:
parent
a04ea1b272
commit
857973a51e
@ -1,13 +1,21 @@
|
||||
package tse.lr2;
|
||||
|
||||
import java.awt.Point;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author aNNiMON
|
||||
*/
|
||||
public class Circle extends Ellipse {
|
||||
|
||||
public boolean isConsist() {
|
||||
return false;
|
||||
public boolean isConsist(Point point) {
|
||||
Point center = getCenterPoint();
|
||||
int radius = center.x - points[0].x;
|
||||
|
||||
double tmp = Math.pow(point.x - center.x, 2);
|
||||
tmp += Math.pow(point.y - center.y, 2);
|
||||
|
||||
return (tmp <= (radius * radius));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user