![JAR search and dependency download from the Maven repository](/logo.png)
net.sourceforge.plantuml.code.SpiralOnRectangle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.code;
public class SpiralOnRectangle {
// ::remove file when __CORE__
private final Spiral spiral = new Spiral();
private final int width;
private final int height;
private final PairInt delta;
public SpiralOnRectangle(int width, int height) {
this.width = width;
this.height = height;
this.delta = new PairInt(width / 2, height / 2);
}
private boolean inside(PairInt point) {
final int x = point.getX();
final int y = point.getY();
return x >= 0 && x < width && y >= 0 && y < height;
}
public PairInt nextPoint() {
do {
final PairInt result = spiral.nextPoint().plus(delta);
if (inside(result)) {
return result;
}
} while (true);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy