Добавлена функция проверки принадлежности точки к окружности
This commit is contained in:
parent
a04ea1b272
commit
857973a51e
@ -1,13 +1,21 @@
|
|||||||
package tse.lr2;
|
package tse.lr2;
|
||||||
|
|
||||||
|
import java.awt.Point;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author aNNiMON
|
* @author aNNiMON
|
||||||
*/
|
*/
|
||||||
public class Circle extends Ellipse {
|
public class Circle extends Ellipse {
|
||||||
|
|
||||||
public boolean isConsist() {
|
public boolean isConsist(Point point) {
|
||||||
return false;
|
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
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user