/
shvidkuli
/
kkrjava
Обзор
Документация
Войти
/
shvidkuli
/
kkrjava
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/main/java/com/montecarlo/geometry/Shape.java
37 строк
1 KB
kroc400
first_commit
30 апр 2026, 22:44
30 апр 2026, 22:44
2347fdb
Код
Авторство
О чём код?
package com.montecarlo.geometry; /** * Contract for a 2D geometric shape that can participate in Monte Carlo area estimation. * * <p>Implement this interface to add new figure types. The only requirements are: * <ul> * <li>point containment test ({@link #contains})</li> * <li>an exact analytical area for error comparison ({@link #analyticalArea})</li> * <li>an axis-aligned bounding box for random-point generation ({@link #getBoundingBox})</li> * </ul> * </p> */ public interface Shape { /** * Returns {@code true} if point {@code p} is inside or on the boundary of this shape. * * @param p the point to test * @return {@code true} if the point belongs to the closed region of the shape */ boolean contains(Point p); /** * Returns the exact analytical area of this shape. * * @return area in the same units as the coordinate space */ double analyticalArea(); /** * Returns the smallest axis-aligned bounding box that fully contains this shape. * * @return the bounding box */ BoundingBox getBoundingBox(); }