Removed trash, improved constraint system (nicer names)

v5stable
Ondřej Hruška 10 years ago
parent a1e35bc696
commit 65bfbbd16a
  1. 3
      .gitignore
  2. 23
      README.md
  3. 2
      src/mightypork/gamecore/gui/components/layout/ColumnHolder.java
  4. 2
      src/mightypork/gamecore/gui/components/layout/RowHolder.java
  5. 15
      src/mightypork/gamecore/gui/components/painters/QuadPainter.java
  6. 2
      src/mightypork/gamecore/gui/screens/LayeredScreen.java
  7. 2
      src/mightypork/gamecore/gui/screens/Screen.java
  8. 18
      src/mightypork/gamecore/gui/screens/ScreenLayer.java
  9. 48
      src/mightypork/gamecore/input/InputSystem.java
  10. 71
      src/mightypork/gamecore/render/DisplaySystem.java
  11. 9
      src/mightypork/gamecore/render/Render.java
  12. 7
      src/mightypork/gamecore/render/fonts/FontRenderer.java
  13. 2
      src/mightypork/rogue/App.java
  14. 26
      src/mightypork/rogue/screens/LayerFps.java
  15. 12
      src/mightypork/rogue/screens/test_bouncyboxes/BouncyBox.java
  16. 17
      src/mightypork/rogue/screens/test_bouncyboxes/LayerBouncyBoxes.java
  17. 17
      src/mightypork/rogue/screens/test_cat_sound/LayerFlyingCat.java
  18. 5
      src/mightypork/rogue/screens/test_font/ScreenTestFont.java
  19. 4
      src/mightypork/rogue/screens/test_render/LayerTestGradient.java
  20. 30
      src/mightypork/test/TestConstr.java
  21. 36
      src/mightypork/utils/math/constraints/CReverseProxy.java
  22. 830
      src/mightypork/utils/math/constraints/Constraints.java
  23. 9
      src/mightypork/utils/math/constraints/VecConstraint.java
  24. 33
      src/mightypork/utils/math/constraints/VecConstraintSynth.java
  25. 23
      src/mightypork/utils/math/constraints/VecWrapper.java
  26. 6
      src/mightypork/utils/math/coord/Vec.java
  27. 11
      src/mightypork/utils/math/coord/VecMathImpl.java
  28. 8
      src/mightypork/utils/math/rect/MutableRect.java
  29. 45
      src/mightypork/utils/math/rect/Rect.java
  30. 100
      src/mightypork/utils/math/rect/RectImpl.java
  31. 8
      src/mightypork/utils/math/rect/RectMath.java
  32. 2
      src/mightypork/utils/math/rect/RectMutable.java
  33. 4
      src/mightypork/utils/math/rect/RectView.java
  34. 279
      src/mightypork/utils/math/rect/xx/RectCalc.java
  35. 909
      src/mightypork/utils/math/rect/xx/Rectd.java

3
.gitignore vendored

@ -1,3 +1,4 @@
/bin/
/target/
*.log
*.log
.attach_pid*

@ -5,7 +5,8 @@ Goals
-----
- Simple retro-themed dungeon crawler
- Multiplayer support
- (Multiplayer support) <- maybe
- Threads for resource loading and event handling
Features
@ -14,23 +15,21 @@ Features
- Full OOP design
- Event driven
- OpenGL 2D rendering
- Random floors
- Real-time gameplay
- Monsters with AI (-> combat system)
- Screen / layer based graphics with Constraint System.
Possibly added
Gameplay
--------------
- Stats and leveling
- Collectable items
- Potions, food
- Simple inventory system
- Random floors
- Turn-based
- Monsters with AI (-> combat system)
- Collectable items, armor upgrades etc.
- Health, Hunger, Level
Used libraries
--------------
- Slick2D
- LWJGL
- LWJGL (OpenGL & OpenAL support)
- SlickUtil (texture loader, audio system)

@ -52,7 +52,7 @@ public class ColumnHolder extends ElementHolder {
{
if (elem == null) return;
elem.setContext(_column(this, cols, col++));
elem.setContext(cColumn(this, cols, col++));
attach(elem);
}

@ -52,7 +52,7 @@ public class RowHolder extends ElementHolder {
{
if (elem == null) return;
elem.setContext(_row(this, rows, row++));
elem.setContext(cRow(this, rows, row++));
attach(elem);
}

@ -20,7 +20,20 @@ public class QuadPainter extends PluggableRenderer {
/**
* Painter with cokloured vertices.
* Painter with solid color
*
* @param color
*/
public QuadPainter(RGB color) {
this.colorHMinVMin = color;
this.colorHMaxVMin = color;
this.colorHMaxVMax = color;
this.colorHMinVMax = color;
}
/**
* Painter with coloured vertices.
*
* @param colorHMinVMin
* @param colorHMaxVMin

@ -30,7 +30,7 @@ public abstract class LayeredScreen extends Screen {
protected void renderScreen()
{
for (final ScreenLayer layer : layers) {
layer.render();
if (layer.isVisible()) layer.render();
}
}

@ -116,7 +116,7 @@ public abstract class Screen extends AppSubModule implements Renderable, KeyBind
if (!isActive()) return;
if (needSetupViewport) {
Render.setupOrtho();
Render.setupOrtho(getDisplay().getSize());
}
Render.pushState();

@ -9,6 +9,7 @@ import mightypork.gamecore.input.KeyBindingPool;
import mightypork.gamecore.input.KeyStroke;
import mightypork.utils.math.constraints.RectConstraint;
import mightypork.utils.math.coord.Vec;
import mightypork.utils.math.coord.VecView;
import mightypork.utils.math.rect.RectView;
@ -21,8 +22,13 @@ public abstract class ScreenLayer extends AppSubModule implements Comparable<Scr
private final Screen screen;
private boolean visible = true;
private final KeyBindingPool keybindings = new KeyBindingPool();
protected final VecView cMousePos = getInput().getMousePos();
protected final VecView cScreenSize = getDisplay().getSize();
/**
* @param screen parent screen
@ -65,6 +71,18 @@ public abstract class ScreenLayer extends AppSubModule implements Comparable<Scr
}
public boolean isVisible()
{
return visible;
}
public void setVisible(boolean visible)
{
this.visible = visible;
}
@Override
public final int compareTo(ScreenLayer o)
{

@ -7,10 +7,10 @@ import mightypork.gamecore.control.bus.events.KeyEvent;
import mightypork.gamecore.control.bus.events.MouseButtonEvent;
import mightypork.gamecore.control.bus.events.MouseMotionEvent;
import mightypork.gamecore.control.timing.Updateable;
import mightypork.gamecore.render.DisplaySystem;
import mightypork.rogue.events.ActionRequest;
import mightypork.rogue.events.ActionRequest.RequestType;
import mightypork.utils.math.coord.MutableCoord;
import mightypork.utils.math.coord.SynthCoord2D;
import mightypork.utils.math.coord.VecMutable;
import mightypork.utils.math.coord.VecView;
@ -30,6 +30,26 @@ public class InputSystem extends RootBusNode implements Updateable, KeyBinder {
// listeners
private final KeyBindingPool keybindings;
private final VecView mousePos = new SynthCoord2D() {
@Override
public double x()
{
if (!Mouse.isInsideWindow()) return Integer.MIN_VALUE;
return Mouse.getX();
}
@Override
public double y()
{
if (!Mouse.isInsideWindow()) return Integer.MIN_VALUE;
// flip Y axis
return Display.getHeight() - Mouse.getY();
}
};
private static boolean inited = false;
@ -127,10 +147,9 @@ public class InputSystem extends RootBusNode implements Updateable, KeyBinder {
final int wheeld = Mouse.getEventDWheel();
if (DisplaySystem.yAxisDown) {
flipScrY(pos);
move.mul(1, -1, 1);
}
// flip Y axis
pos.setY(Display.getHeight() - pos.y());
move.mul(1, -1, 1);
if (button != -1 || wheeld != 0) {
getEventBus().send(new MouseButtonEvent(pos.copy(), button, down, wheeld));
@ -151,22 +170,23 @@ public class InputSystem extends RootBusNode implements Updateable, KeyBinder {
}
private static void flipScrY(VecMutable c)
/**
* Get absolute mouse position
*
* @return mouse position
*/
public VecView getMousePos()
{
if (DisplaySystem.yAxisDown) c.setY(DisplaySystem.getHeight() - c.y());
return mousePos;
}
/**
* Get absolute mouse position
*
* @return mouse position
* @return true if mouse is inside window.
*/
public static VecView getMousePos()
public boolean isMouseInside()
{
final VecMutable pos = new MutableCoord(Mouse.getX(), Mouse.getY());
flipScrY(pos);
return pos.view();
return Mouse.isInsideWindow();
}

@ -11,7 +11,7 @@ import mightypork.gamecore.control.bus.events.ScreenChangeEvent;
import mightypork.gamecore.control.timing.FpsMeter;
import mightypork.utils.logging.Log;
import mightypork.utils.math.constraints.RectConstraint;
import mightypork.utils.math.coord.FixedCoord;
import mightypork.utils.math.coord.SynthCoord2D;
import mightypork.utils.math.coord.VecView;
import mightypork.utils.math.rect.FixedRect;
import mightypork.utils.math.rect.RectView;
@ -31,10 +31,24 @@ public class DisplaySystem extends AppModule implements RectConstraint {
private DisplayMode windowDisplayMode;
private int targetFps;
/** Y axis goes down (not up); Used also to adjust inputs. */
public static boolean yAxisDown = true;
private FpsMeter fpsMeter;
private final VecView cScreenSize = new SynthCoord2D() {
@Override
public double y()
{
return Display.getHeight();
}
@Override
public double x()
{
return Display.getWidth();
}
};
/**
* @param app app access
@ -175,27 +189,27 @@ public class DisplaySystem extends AppModule implements RectConstraint {
*
* @return size
*/
public static VecView getSize()
public VecView getSize()
{
return new FixedCoord(getWidth(), getHeight());
return cScreenSize;
}
/**
* @return screen width
*/
public static int getWidth()
public int getWidth()
{
return Display.getWidth();
return cScreenSize.xi();
}
/**
* @return screen height
*/
public static int getHeight()
public int getHeight()
{
return Display.getHeight();
return cScreenSize.yi();
}
@ -245,43 +259,4 @@ public class DisplaySystem extends AppModule implements RectConstraint {
{
return getSize().half();
}
// private static final VecView size = new SynthCoord2D() {
//
// @Override
// public double y()
// {
// return getHeight();
// }
//
//
// @Override
// public double x()
// {
// return getWidth();
// }
// };
//
// /** Screen width constraint */
// private static final NumberConstraint width = size.xc();
//
// /** Screen height constaint */
// private static final NumberConstraint height = size.yc();
//
// private static final VecView center = new SynthCoord2D() {
//
// @Override
// public double y()
// {
// return size.half().x();
// }
//
//
// @Override
// public double x()
// {
// return size.half().y();
// }
// };
}

@ -11,6 +11,7 @@ import mightypork.utils.logging.Log;
import mightypork.utils.math.color.RGB;
import mightypork.utils.math.coord.FixedCoord;
import mightypork.utils.math.coord.Vec;
import mightypork.utils.math.coord.VecView;
import mightypork.utils.math.rect.Rect;
import org.lwjgl.opengl.GL11;
@ -540,15 +541,15 @@ public class Render {
/**
* Setup Ortho projection for 2D graphics
* @param size viewport size (screen size)
*/
public static void setupOrtho()
public static void setupOrtho(VecView size)
{
// fix projection for changed size
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
final Vec s = DisplaySystem.getSize();
glViewport(0, 0, s.xi(), s.yi());
glOrtho(0, s.x(), (DisplaySystem.yAxisDown ? 1 : -1) * s.y(), 0, -1000, 1000);
glViewport(0, 0, size.xi(), size.yi());
glOrtho(0, size.xi(), size.yi(), 0, -1000, 1000);
// back to modelview
glMatrixMode(GL_MODELVIEW);

@ -1,7 +1,6 @@
package mightypork.gamecore.render.fonts;
import static mightypork.utils.math.constraints.Constraints.*;
import mightypork.gamecore.render.Render;
import mightypork.utils.math.color.RGB;
import mightypork.utils.math.coord.Vec;
@ -148,16 +147,16 @@ public class FontRenderer {
switch (align) {
case LEFT:
start = _top_left(bounds);
start = bounds.getTopLeft();
break;
case CENTER:
start = _center_top(bounds);
start = bounds.getTopCenter();
break;
case RIGHT:
default:
start = _top_right(bounds);
start = bounds.getTopRight();
break;
}

@ -56,7 +56,7 @@ public class App extends BaseApp {
screens.add(new ScreenTestFont(this));
screens.add(new ScreenTestRender(this));
screens.showScreen("test.cat");
screens.showScreen("test.bouncy");
}

@ -2,9 +2,12 @@ package mightypork.rogue.screens;
import static mightypork.utils.math.constraints.Constraints.*;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.painters.TextPainter;
import mightypork.gamecore.gui.screens.Screen;
import mightypork.gamecore.gui.screens.ScreenLayer;
import mightypork.gamecore.input.KeyStroke;
import mightypork.gamecore.input.Keys;
import mightypork.gamecore.render.fonts.FontRenderer.Align;
import mightypork.gamecore.render.fonts.GLFont;
import mightypork.rogue.Res;
@ -22,20 +25,31 @@ public class LayerFps extends ScreenLayer {
public LayerFps(Screen screen) {
super(screen);
final StringProvider text = new StringProvider() {
/*
* Toggle key: F3
*/
bindKeyStroke(new KeyStroke(Keys.KEY_F3), new Action() {
@Override
public String getString()
public void execute()
{
return getDisplay().getFps() + " fps";
setVisible(!isVisible());
}
};
});
final GLFont font = Res.getFont("default");
final RectConstraint constraint = _box(_sub(_top_right(this), 8, 8), 0, 32);
final RectConstraint constraint = cBox(cAdd(cTopRight(this), -8, 8), 0, 32);
tp = new TextPainter(font, Align.RIGHT, RGB.WHITE, new StringProvider() {
@Override
public String getString()
{
return getDisplay().getFps() + " fps";
}
});
tp = new TextPainter(font, Align.RIGHT, RGB.WHITE, text);
tp.setContext(constraint);
tp.setShadow(RGB.BLACK, Vec.ONE);

@ -26,16 +26,16 @@ public class BouncyBox extends PluggableRenderer implements Updateable {
public BouncyBox() {
// create box
final NumberConstraint side = _height(this);
RectConstraint abox = _box(this, side, side);
final NumberConstraint side = cHeight(this);
RectConstraint abox = cBox(this, side, side);
// move
final NumberConstraint move_length = _sub(_width(this), side);
final NumberConstraint offset = _mul(move_length, pos);
abox = _move(abox, offset, 0);
final NumberConstraint move_length = cSub(cWidth(this), side);
final NumberConstraint offset = cMul(move_length, pos);
abox = cMove(abox, offset, 0);
// add padding
abox = _shrink(abox, _percent(side, 10));
abox = cShrink(abox, cPerc(side, 10));
box = abox;
}

@ -16,7 +16,7 @@ import mightypork.gamecore.render.fonts.FontRenderer.Align;
import mightypork.rogue.Res;
import mightypork.utils.math.color.RGB;
import mightypork.utils.math.constraints.RectConstraint;
import mightypork.utils.string.StringProvider;
import mightypork.utils.math.coord.FixedCoord;
public class LayerBouncyBoxes extends ScreenLayer {
@ -47,7 +47,7 @@ public class LayerBouncyBoxes extends ScreenLayer {
});
// shrink screen rect by 8% on all sides
final RectConstraint holder_rect = _shrink(this, _percent(_height(this), 4));
final RectConstraint holder_rect = cShrink(this, cPerc(cWidth(this), 4));
addChildClient(layout = new RowHolder(screen, holder_rect, 11));
@ -57,14 +57,11 @@ public class LayerBouncyBoxes extends ScreenLayer {
boxes.add(bbr);
}
layout.add(new TextPainter(Res.getFont("default"), Align.LEFT, RGB.WHITE, new StringProvider() {
@Override
public String getString()
{
return "Running at " + getDisplay().getFps() + " fps!";
}
}));
final TextPainter tp = new TextPainter(Res.getFont("default"), Align.LEFT, RGB.WHITE);
tp.setText("Press \"C\" for \"Cat\" screen.");
tp.setShadow(RGB.RED, new FixedCoord(2, 2));
layout.add(tp);
}

@ -8,6 +8,7 @@ import java.util.Random;
import mightypork.gamecore.control.bus.events.MouseButtonEvent;
import mightypork.gamecore.control.timing.Updateable;
import mightypork.gamecore.gui.components.painters.ImagePainter;
import mightypork.gamecore.gui.components.painters.QuadPainter;
import mightypork.gamecore.gui.components.painters.TextPainter;
import mightypork.gamecore.gui.screens.Screen;
import mightypork.gamecore.gui.screens.ScreenLayer;
@ -32,6 +33,7 @@ public class LayerFlyingCat extends ScreenLayer implements Updateable, MouseButt
private final ImagePainter cat;
private final TextPainter tp;
private final QuadPainter qp;
public LayerFlyingCat(Screen screen) {
@ -41,14 +43,18 @@ public class LayerFlyingCat extends ScreenLayer implements Updateable, MouseButt
cat = new ImagePainter(Res.getTxQuad("test.kitten"));
cat.setContext(_align(_box(size, size), pos));
cat.setContext(cCenterTo(cBox(size, size), pos));
tp = new TextPainter(Res.getFont("default"));
tp.setAlign(Align.CENTER);
tp.setColor(RGB.YELLOW);
tp.setText("Meow!");
tp.setShadow(RGB.dark(0.8), new FixedCoord(2, 2));
tp.setContext(_align(_box(64, 64), _mouseX, _mouseY));
tp.setContext(cCenterTo(cBox(64, 64), cMousePos));
qp = QuadPainter.gradV(RGB.YELLOW, RGB.RED);
qp.setContext(cExpand(cBottomLeft(cat), 0, 0, 50, 50));
/*
* Register keys
@ -79,9 +85,9 @@ public class LayerFlyingCat extends ScreenLayer implements Updateable, MouseButt
final Vec pos = event.getPos();
this.pos.animateWithSpeed(pos, 200);
this.pos.animateWithSpeed(pos, 160);
size.animate(200 + rand.nextInt(600), this.pos.getDuration() / 2);
size.animate(200 + rand.nextInt(600), Math.max(0.2, this.pos.getDuration() / 2));
}
@ -90,8 +96,7 @@ public class LayerFlyingCat extends ScreenLayer implements Updateable, MouseButt
{
cat.render();
tp.render();
//System.out.println(tp.getRect());
qp.render();
}

@ -8,6 +8,7 @@ import mightypork.gamecore.gui.screens.Screen;
import mightypork.gamecore.render.fonts.FontRenderer.Align;
import mightypork.rogue.Res;
import mightypork.utils.math.color.RGB;
import mightypork.utils.math.constraints.NumberConstraint;
import mightypork.utils.math.constraints.RectConstraint;
@ -22,7 +23,9 @@ public class ScreenTestFont extends Screen {
tp = new TextPainter(Res.getFont("default"), Align.CENTER, RGB.GREEN);
tp.setText("Hello World!");
final RectConstraint strbox = _align(_box(_div(_screenH, 10)), this);
final NumberConstraint fontHeight = cMul(getDisplay().getSize().yc(), 0.1);
final RectConstraint strbox = cCenterTo(cBox(fontHeight), this);
tp.setContext(strbox);
}

@ -22,8 +22,8 @@ public class LayerTestGradient extends ScreenLayer {
public LayerTestGradient(Screen screen) {
super(screen);
pos1 = _cache(p, _grow_down(_top_edge(this), 64));
pos2 = _cache(p, _shrink_top(_grow_right(_left_edge(this), 64), 64));
pos1 = cCached(p, cGrowDown(cTopEdge(this), 64));
pos2 = cCached(p, cShrinkTop(cGrowRight(cLeftEdge(this), 64), 64));
}

@ -0,0 +1,30 @@
package mightypork.test;
import mightypork.utils.math.rect.FixedRect;
import mightypork.utils.math.rect.RectView;
public class TestConstr {
public static void main(String[] args)
{
final RectView rm = new FixedRect(0, 0, 100, 100);
System.out.println(rm);
final RectView added = rm.move(10, 10);
System.out.println(added);
System.out.println(added.getOrigin());
System.out.println(added.getSize());
System.out.println(added.getOrigin().add(added.getSize()));
// VecMutable vv = new MutableCoord(0,0);
//
// System.out.println(vv);
// System.out.println(vv.add(50,50));
}
}

@ -0,0 +1,36 @@
package mightypork.utils.math.constraints;
import mightypork.utils.math.coord.VecView;
public class CReverseProxy extends VecView {
private final VecConstraint constraint;
public CReverseProxy(VecConstraint wrapped) {
this.constraint = wrapped;
}
@Override
public double x()
{
return constraint.getVec().x();
}
@Override
public double y()
{
return constraint.getVec().y();
}
@Override
public double z()
{
return constraint.getVec().z();
}
}

File diff suppressed because it is too large Load Diff

@ -7,4 +7,13 @@ import mightypork.utils.math.coord.VecView;
public interface VecConstraint {
VecView getVec();
NumberConstraint xc();
NumberConstraint yc();
NumberConstraint zc();
}

@ -0,0 +1,33 @@
package mightypork.utils.math.constraints;
import mightypork.utils.math.coord.VecView;
public abstract class VecConstraintSynth implements VecConstraint {
@Override
public abstract VecView getVec();
@Override
public NumberConstraint xc()
{
return Constraints.cX(getVec());
}
@Override
public NumberConstraint yc()
{
return Constraints.cY(getVec());
}
@Override
public NumberConstraint zc()
{
return Constraints.cZ(getVec());
}
}

@ -1,23 +0,0 @@
package mightypork.utils.math.constraints;
import mightypork.utils.math.coord.Vec;
import mightypork.utils.math.coord.VecView;
public class VecWrapper implements VecConstraint {
private final Vec wrapped;
public VecWrapper(Vec wrapped) {
this.wrapped = wrapped;
}
@Override
public VecView getVec()
{
return wrapped.view();
}
}

@ -2,6 +2,7 @@ package mightypork.utils.math.coord;
import mightypork.utils.math.constraints.NumberConstraint;
import mightypork.utils.math.constraints.VecConstraint;
/**
@ -9,7 +10,7 @@ import mightypork.utils.math.constraints.NumberConstraint;
*
* @author MightyPork
*/
public interface Vec {
public interface Vec extends VecConstraint {
public static final VecView ZERO = new FixedCoord(0, 0, 0);
public static final VecView ONE = new FixedCoord(1, 1, 1);
@ -72,18 +73,21 @@ public interface Vec {
/**
* @return X constraint
*/
@Override
NumberConstraint xc();
/**
* @return Y constraint
*/
@Override
NumberConstraint yc();
/**
* @return Z constraint
*/
@Override
NumberConstraint zc();

@ -71,6 +71,13 @@ abstract class VecMathImpl<V> implements VecMath<V> {
}
@Override
public VecView getVec()
{
return this.view();
}
/**
* <p>
* Some operation was performed and this result was obtained.
@ -212,7 +219,7 @@ abstract class VecMathImpl<V> implements VecMath<V> {
@Override
public V add(double x, double y, double z)
{
return result(x, y, z);
return result(x() + x, y() + y, z() + z);
}
@ -386,6 +393,6 @@ abstract class VecMathImpl<V> implements VecMath<V> {
@Override
public String toString()
{
return String.format("[ %.2f ; %.2f ; %.2f ]", x(), y(), z());
return String.format("(%.1f %.1f %.1f)", x(), y(), z());
}
}

@ -165,13 +165,13 @@ public class MutableRect extends RectImpl<RectMutable> implements RectMutable {
* Shrink the rect
*
* @param left shrink
* @param top shrink
* @param right shrink
* @param top shrink
* @param bottom shrink
* @return result
*/
@Override
public RectMutable shrink(double left, double top, double right, double bottom)
public RectMutable shrink(double left, double right, double top, double bottom)
{
pos.add(left, top);
size.sub(left + right, top + bottom).abs();
@ -183,13 +183,13 @@ public class MutableRect extends RectImpl<RectMutable> implements RectMutable {
* Grow the rect
*
* @param left growth
* @param top growth
* @param right growth
* @param top growth
* @param bottom growth
* @return result
*/
@Override
public RectMutable grow(double left, double top, double right, double bottom)
public RectMutable grow(double left, double right, double top, double bottom)
{
pos.sub(left, top);
size.add(left + right, top + bottom).abs();

@ -1,6 +1,7 @@
package mightypork.utils.math.rect;
import mightypork.utils.math.constraints.RectConstraint;
import mightypork.utils.math.coord.VecView;
@ -9,7 +10,7 @@ import mightypork.utils.math.coord.VecView;
*
* @author MightyPork
*/
public interface Rect {
public interface Rect extends RectConstraint {
RectView ONE = new FixedRect(0, 0, 1, 1);
RectView ZERO = new FixedRect(0, 0, 0, 0);
@ -37,30 +38,42 @@ public interface Rect {
VecView getOrigin();
/**
* @return center
*/
VecView getCenter();
/**
* @return rect size
*/
VecView getSize();
/**
* @return rect width
*/
double getWidth();
/**
* @return rect height
*/
double getHeight();
VecView getTopLeft();
VecView getTopCenter();
VecView getTopRight();
VecView getCenterLeft();
VecView getCenter();
VecView getCenterRight();
VecView getBottomLeft();
VecView getBottomCenter();
VecView getBottomRight();
double xMin();

@ -1,16 +1,101 @@
package mightypork.utils.math.rect;
import static mightypork.utils.math.constraints.Constraints.*;
import mightypork.utils.math.constraints.VecConstraint;
import mightypork.utils.math.coord.Vec;
import mightypork.utils.math.coord.VecView;
public abstract class RectImpl<T extends Rect> implements RectMath<T> {
private VecConstraint tl, tc, tr, cl, c, cr, bl, bc, br;
@Override
public RectView getRect()
{
return this.view();
}
@Override
public abstract VecView getOrigin();
@Override
public abstract VecView getSize();
@Override
public VecView getTopLeft()
{
if (tl == null) tl = cTopLeft(this);
return tl.getVec();
}
@Override
public VecView getTopCenter()
{
if (tc == null) tc = cTopCenter(this);
return tc.getVec();
}
@Override
public VecView getTopRight()
{
if (tr == null) tr = cTopRight(this);
return tr.getVec();
}
@Override
public VecView getCenterLeft()
{
if (cl == null) cl = cCenterLeft(this);
return cl.getVec();
}
@Override
public final VecView getCenter()
{
return getOrigin().add(getSize().half());
if (c == null) c = cCenter(this);
return c.getVec();
}
@Override
public VecView getCenterRight()
{
if (cr == null) cr = cCenterRight(this);
return cr.getVec();
}
@Override
public VecView getBottomLeft()
{
if (bl == null) bl = cBottomLeft(this);
return bl.getVec();
}
@Override
public VecView getBottomCenter()
{
if (bc == null) bc = cBottomCenter(this);
return bc.getVec();
}
@Override
public VecView getBottomRight()
{
if (br == null) br = cBottomRight(this);
return br.getVec();
}
@ -73,7 +158,7 @@ public abstract class RectImpl<T extends Rect> implements RectMath<T> {
@Override
public final T shrink(double x, double y)
{
return shrink(x, y, x, y);
return shrink(x, x, y, y);
}
@ -87,7 +172,7 @@ public abstract class RectImpl<T extends Rect> implements RectMath<T> {
@Override
public final T grow(double x, double y)
{
return grow(x, y, x, y);
return grow(x, x, y, y);
}
@ -98,6 +183,13 @@ public abstract class RectImpl<T extends Rect> implements RectMath<T> {
}
@Override
public RectMutable copy()
{
return new MutableRect(this);
}
@Override
public final boolean contains(Vec point)
{
@ -116,6 +208,6 @@ public abstract class RectImpl<T extends Rect> implements RectMath<T> {
@Override
public String toString()
{
return String.format("Rect[ %s - %s ]", getOrigin().toString(), getOrigin().add(getSize()));
return String.format("Rect { %s - %s }", getOrigin().toString(), getOrigin().add(getSize()));
}
}

@ -53,12 +53,12 @@ interface RectMath<T extends Rect> extends Rect {
* Shrink the rect
*
* @param left shrink
* @param top shrink
* @param right shrink
* @param top shrink
* @param bottom shrink
* @return result
*/
T shrink(double left, double top, double right, double bottom);
T shrink(double left, double right, double top, double bottom);
/**
@ -84,12 +84,12 @@ interface RectMath<T extends Rect> extends Rect {
* Grow the rect
*
* @param left growth
* @param top growth
* @param right growth
* @param top growth
* @param bottom growth
* @return result
*/
T grow(double left, double top, double right, double bottom);
T grow(double left, double right, double top, double bottom);
/**

@ -4,7 +4,7 @@ package mightypork.utils.math.rect;
import mightypork.utils.math.coord.Vec;
public interface RectMutable extends Rect {
public interface RectMutable extends RectMath<RectMutable> {
/**
* Set to other rect's coordinates

@ -25,14 +25,14 @@ public abstract class RectView extends RectImpl<RectView> {
@Override
public RectView shrink(double left, double top, double right, double bottom)
public RectView shrink(double left, double right, double top, double bottom)
{
return result(getOrigin().add(left, top), getSize().sub(left + right, top + bottom));
}
@Override
public RectView grow(double left, double top, double right, double bottom)
public RectView grow(double left, double right, double top, double bottom)
{
return result(getOrigin().sub(left, top), getSize().add(left + right, top + bottom));
}

@ -1,279 +0,0 @@
package mightypork.utils.math.rect.xx;
//package mightypork.utils.math.rect;
//
//import mightypork.utils.math.constraints.NumberConstraint;
//import mightypork.utils.math.coord.VecValue;
//import mightypork.utils.math.coord.VecView;
//import mightypork.utils.math.coord.SynthCoord3D;
//
//
//public class RectCalc {
// /* ================= Coords ================= */
//
// public static NumberConstraint _x(final VecValue c)
// {
// return c.xc();
// }
//
//
// public static NumberConstraint _y(final VecValue c)
// {
// return c.yc();
// }
//
//
// public static NumberConstraint _z(final VecValue c)
// {
// return c.zc();
// }
//
//
// public static VecView _neg(final VecValue c)
// {
// return _mul(c, -1);
// }
//
//
// public static VecView _half(final VecValue c)
// {
// return _mul(c, 0.5);
// }
//
//
// // --- add ---
//
// public static VecView _add(final VecValue c1, final VecValue c2)
// {
// return new SynthCoord3D() {
//
// @Override
// public double x()
// {
// return c1.x() + c2.x();
// }
//
//
// @Override
// public double y()
// {
// return c1.y() + c2.y();
// }
//
//
// @Override
// public double z()
// {
// return c1.z() + c2.z();
// }
//
// };
// }
//
//
// public static VecView _add(final VecValue c, final Object x, final Object y)
// {
// return _add(c, x, y, 0);
// }
//
//
// public static VecView _add(final VecValue c, final Object x, final Object y, final Object z)
// {
// return new SynthCoord3D() {
//
// @Override
// public double x()
// {
// return c.x() + num(x);
// }
//
//
// @Override
// public double y()
// {
// return c.y() + num(y);
// }
//
//
// @Override
// public double z()
// {
// return c.z() + num(z);
// }
//
// };
// }
//
//
// // --- sub ---
//
// public static VecView _sub(final VecValue c1, final VecValue c2)
// {
// return new SynthCoord3D() {
//
// @Override
// public double x()
// {
// return c1.x() - c2.x();
// }
//
//
// @Override
// public double y()
// {
// return c1.y() - c2.y();
// }
//
//
// @Override
// public double z()
// {
// return c1.z() - c2.z();
// }
//
// };
// }
//
//
// public static VecView _sub(final VecValue c, final Object x, final Object y)
// {
// return _add(c, x, y, 0);
// }
//
//
// public static VecView _sub(final VecValue c, final Object x, final Object y, final Object z)
// {
// return new SynthCoord3D() {
//
// @Override
// public double x()
// {
// return c.x() - num(x);
// }
//
//
// @Override
// public double y()
// {
// return c.y() - num(y);
// }
//
//
// @Override
// public double z()
// {
// return c.z() - num(z);
// }
//
// };
// }
//
//
// // --- mul ---
//
// public static VecView _mul(final VecValue c, final Object mul)
// {
// return new SynthCoord3D() {
//
// @Override
// public double x()
// {
// return c.x() * num(mul);
// }
//
//
// @Override
// public double y()
// {
// return c.y() * num(mul);
// }
//
//
// @Override
// public double z()
// {
// return c.z() * num(mul);
// }
//
// };
// }
//
// public static VecView _origin(final Rect r)
// {
// return r.getOrigin().view();
// }
//
//
// public static VecView _size(final Rect r)
// {
// return r.getSize().view();
// }
//
//
// public static NumberConstraint _width(final Rect r)
// {
// return _x(_size(r));
// }
//
//
// public static NumberConstraint _height(final Rect r)
// {
// return _y(_size(r));
// }
//
//
// public static VecView _center(final Rect r)
// {
// return _add(_origin(r), _half(_size(r)));
// }
//
//
// public static VecView _top_left(final Rect r)
// {
// return _origin(r);
// }
//
//
// public static VecView _top_right(final Rect r)
// {
// return _add(_origin(r), _width(r), 0);
// }
//
//
// public static VecView _bottom_left(final Rect r)
// {
// return _add(_origin(r), 0, _height(r));
// }
//
//
// public static VecView _bottom_right(final Rect r)
// {
// return _add(_origin(r), _size(r));
// }
//
//
// public static VecView _center_top(final Rect r)
// {
// return _add(_origin(r), _half(_width(r)), 0);
// }
//
//
// public static VecView _center_bottom(final Rect r)
// {
// return _add(_origin(r), _half(_width(r)), _height(r));
// }
//
//
// public static VecView _center_left(final Rect r)
// {
// return _add(_origin(r), 0, _half(_height(r)));
// }
//
//
// public static VecView _center_right(final Rect r)
// {
// return _add(_origin(r), _width(r), _half(_height(r)));
// }
//
//}

@ -1,909 +0,0 @@
package mightypork.utils.math.rect.xx;
//package mightypork.utils.math.rect;
//
//
//import mightypork.utils.math.Calc;
//import mightypork.utils.math.constraints.NumberConstraint;
//import mightypork.utils.math.constraints.RectConstraint;
//import mightypork.utils.math.coord.ConstrCoord;
//import mightypork.utils.math.coord.VecValue;
//import mightypork.utils.math.coord.VecArith;
//import mightypork.utils.math.coord.VecMutable;
//
//
///**
// * Rectangle determined by two coordinates - min and max.
// *
// * @author MightyPork
// */
//public class Rectd implements RectConstraint, IRect {
//
// public static final IRect ZERO = new FixedRect(0, 0, 0, 0).freeze();
// public static final Rect ONE = new FixedRect(0, 0, 1, 1).freeze();
//
//
// /**
// * Rectangle from size; coords are copied.
// *
// * @param min min coord
// * @param size rect size
// * @return the rect
// */
// public static Rect fromSize(VecArith min, VecValue size)
// {
// return fromSize(min, size.xi(), size.yi());
// }
//
//
// /**
// * Make rect from min coord and size; coords are copied.
// *
// * @param min min coord
// * @param width size x
// * @param height size y
// * @return the new rect
// */
// public static Rect fromSize(VecArith min, double width, double height)
// {
// return new FixedRect(min.copy(), min.add(width, height));
// }
//
//
// /**
// * Rectangle from size
// *
// * @param sizeX size x
// * @param sizeY size y
// * @return rect
// */
// public static IRect fromSize(double sizeX, double sizeY)
// {
// return fromSize(0, 0, sizeX, sizeY);
// }
//
//
// /**
// * Get rect from size
// *
// * @param size size
// * @return rect
// */
// public static IRect fromSize(VecValue size)
// {
// return fromSize(0, 0, size.x(), size.y());
// }
//
//
// /**
// * Make rect from min coord and size
// *
// * @param xmin min x
// * @param ymin min y
// * @param width size x
// * @param height size y
// * @return the new rect
// */
// public static Rect fromSize(double xmin, double ymin, double width, double height)
// {
// return new FixedRect(xmin, ymin, xmin + width, ymin + height);
// }
//
// /** Lowest coordinates xy */
// protected final VecArith min;
//
// /** Highest coordinates xy */
// protected final VecArith max;
//
// // view of secondary corners.
//
// //@formatter:off
// private final ConstrCoord HMinVMax = new ConstrCoord(
// new NumberConstraint() {
// @Override
// public double getValue()
// {
// return min.x();
// }
// },
// new NumberConstraint() {
// @Override
// public double getValue()
// {
// return max.y();
// }
// },
// null
// );
//
//
// private final ConstrCoord HMaxVMin = new ConstrCoord(
// new NumberConstraint() {
// @Override
// public double getValue() {
// return max.x();
// }
// },
// new NumberConstraint() {
// @Override
// public double getValue()
// {
// return min.y();
// }
// },
// null
// );
// //@formatter:on
//
// private boolean frozen;
//
//
// public boolean isWritable()
// {
// return !frozen && !isView();
// }
//
//
// public boolean isView()
// {
// return false;
// }
//
//
// public Rect freeze()
// {
// min.copy();
// max.copy();
// frozen = true;
// return this;
// }
//
//
// /**
// * Get a readonly view
// *
// * @return view
// */
// public RectView view()
// {
// return new RectView(this);
// }
//
//
// protected void assertWritable()
// {
// if (!isWritable()) {
// throw new UnsupportedOperationException("This Rect is not writable.");
// }
// }
//
//
// /**
// * New Rect [0, 0, 0, 0]
// */
// public Rect() {
// this(0, 0, 0, 0);
// }
//
//
// /**
// * Rect [0, 0, size.x, size.y]
// *
// * @param size size coord
// */
// public Rect(VecValue size) {
// this(0, 0, size.x(), size.y());
// }
//
//
// /**
// * New rect of two coords; Coords are plugged in directly (ie. views can be
// * used for frozen rect representing another)
// *
// * @param min coord 1
// * @param max coord 2
// */
// public Rect(VecValue min, VecValue max) {
// this.min = min; // must not copy
// this.max = max; // must not copy
// }
//
//
// /**
// * New Rect
// *
// * @param xmin lower x
// * @param ymin lower y
// * @param xmax upper x
// * @param ymax upper y
// */
// public Rect(double xmin, double ymin, double xmax, double ymax) {
// min = new VecArith(xmin, ymin);
// max = new VecArith(xmax, ymax);
// }
//
//
// /**
// * Rect [0, 0, x, y]
// *
// * @param x width
// * @param y height
// */
// public Rect(double x, double y) {
// this(0, 0, x, y);
// }
//
//
// /**
// * New rect as a copy of other rect
// *
// * @param r other rect
// */
// public Rect(Rect r) {
// this(r.min.copy(), r.max.copy());
// }
//
//
// /**
// * Get offset copy (add)
// *
// * @param move offset vector
// * @return offset copy
// */
// @Override
// public Rect move(VecMutable move)
// {
// return copy().add_ip(move);
// }
//
//
// /**
// * Add X and Y to all coordinates in a copy
// *
// * @param x x to add
// * @param y y to add
// * @return copy changed
// */
// @Override
// public Rect move(double x, double y)
// {
// return move(new VecArith(x, y));
// }
//
//
// /**
// * Offset in place (add)
// *
// * @param move offset vector
// * @return this
// */
// public Rect add_ip(VecMutable move)
// {
// min.add_ip(move);
// max.add_ip(move);
// return this;
// }
//
//
// /**
// * Add X and Y to all coordinates in place
// *
// * @param x x to add
// * @param y y to add
// * @return this
// */
// public IRect add_ip(double x, double y)
// {
// return add_ip(new VecArith(x, y));
// }
//
//
// /**
// * Get a copy
// *
// * @return copy
// */
// @Override
// public Rect copy()
// {
// return new FixedRect(this);
// }
//
//
// /**
// * Get rect center
// *
// * @return center
// */
// @Override
// public VecValue getCenter()
// {
// return min.midTo(max).copy();
// }
//
//
// /**
// * Get center of the lower edge.
// *
// * @return center
// */
// @Override
// public VecValue getCenterVMin()
// {
// return new VecArith((max.x() + min.x()) / 2D, min.y()).copy();
// }
//
//
// /**
// * Get center of the left edge.
// *
// * @return center
// */
// @Override
// public VecValue getCenterHMin()
// {
// return new VecArith(min.x(), (max.y() + min.y()) / 2D).copy();
// }
//
//
// /**
// * Get center of the right edge.
// *
// * @return center
// */
// @Override
// public VecValue getCenterHMax()
// {
// return new VecArith(max.x(), (max.y() + min.y()) / 2D).copy();
// }
//
//
// /**
// * Get center of the top edge.
// *
// * @return center
// */
// @Override
// public VecValue getCenterVMax()
// {
// return new VecArith((max.x() + min.x()) / 2D, max.y()).copy();
// }
//
//
// /**
// * Get left bottom
// *
// * @return center
// */
// @Override
// public VecArith getHMinVMin()
// {
// return min.view();
// }
//
//
// /**
// * Get left top
// *
// * @return center
// */
// @Override
// public VecValue getHMinVMax()
// {
// return HMinVMax;
// }
//
//
// /**
// * Get right bottom
// *
// * @return center
// */
// @Override
// public VecValue getHMaxVMin()
// {
// return HMaxVMin;
// }
//
//
// /**
// * Get right top
// *
// * @return center
// */
// @Override
// public VecArith getHMaxVMax()
// {
// return max.view();
// }
//
//
// /**
// * Alias for getX2Y2
// *
// * @return highest coordinates xy
// */
// @Override
// public VecMutable getMax()
// {
// return getHMaxVMax();
// }
//
//
// /**
// * Alias for getX1Y1
// *
// * @return lowest coordinates xy
// */
// @Override
// public VecMutable getMin()
// {
// return getHMinVMin();
// }
//
//
// /**
// * Alias for getX1Y1
// *
// * @return lowest coordinates xy
// */
// public VecValue getOrigin()
// {
// return getHMinVMin();
// }
//
//
// /**
// * Shrink to sides in copy
// *
// * @param shrink shrink size (added to each side)
// * @return shrinkn copy
// */
// @Override
// public IRect shrink(VecValue shrink)
// {
// return copy().shrink_ip(shrink);
// }
//
//
// /**
// * Shrink to sides in copy
// *
// * @param x x to add
// * @param y y to add
// * @return changed copy
// */
// @Override
// public IRect shrink(double x, double y)
// {
// return copy().shrink_ip(x, y);
// }
//
//
// /**
// * Shrink to sides in place
// *
// * @param shrink shrink size (added to each side)
// * @return this
// */
// public IRect shrink_ip(VecValue shrink)
// {
// shrink_ip(shrink.x(), shrink.y());
// return this;
// }
//
//
// /**
// * Shrink to sides in place
// *
// * @param x horizontal shrink
// * @param y vertical shrink
// * @return this
// */
// public IRect shrink_ip(double x, double y)
// {
// min.sub_ip(x, y);
// max.add_ip(-x, -y);
// return this;
// }
//
//
// /**
// * Shrink the rect
// *
// * @param xmin shrink
// * @param ymin shrink
// * @param xmax shrink
// * @param ymax shrink
// * @return changed copy
// */
// @Override
// public Rect shrink(double xmin, double ymin, double xmax, double ymax)
// {
// return copy().shrink_ip(xmin, ymin, xmax, ymax);
// }
//
//
// /**
// * Shrink the rect in place
// *
// * @param xmin shrink
// * @param ymin shrink
// * @param xmax shrink
// * @param ymax shrink
// * @return this
// */
// public Rect shrink_ip(double xmin, double ymin, double xmax, double ymax)
// {
// min.add_ip(xmin, ymin);
// max.add_ip(-xmax, -ymax);
// return this;
// }
//
//
// /**
// * Grow to sides in copy
// *
// * @param grow grow size (added to each side)
// * @return grown copy
// */
// @Override
// public IRect grow(VecValue grow)
// {
// return copy().grow_ip(grow);
// }
//
//
// /**
// * Grow to sides in copy
// *
// * @param x horizontal grow
// * @param y vertical grow
// * @return changed copy
// */
// @Override
// public IRect grow(double x, double y)
// {
// return copy().grow_ip(x, y);
// }
//
//
// /**
// * Grow to sides in place
// *
// * @param grow grow size (added to each side)
// * @return this
// */
// public IRect grow_ip(VecValue grow)
// {
// grow_ip(grow.x(), grow.y());
// return this;
// }
//
//
// /**
// * Grow to sides in place
// *
// * @param x horizontal grow
// * @param y vertical grow
// * @return this
// */
// public IRect grow_ip(double x, double y)
// {
// min.sub_ip(x, y);
// max.add_ip(x, y);
// return this;
// }
//
//
// /**
// * Grow the rect
// *
// * @param xmin growth
// * @param ymin growth
// * @param xmax growth
// * @param ymax growth
// * @return changed copy
// */
// @Override
// public Rect grow(double xmin, double ymin, double xmax, double ymax)
// {
// return copy().grow_ip(xmin, ymin, xmax, ymax);
// }
//
//
// /**
// * Grow the rect in place
// *
// * @param xmin growth
// * @param ymin growth
// * @param xmax growth
// * @param ymax growth
// * @return this
// */
// public Rect grow_ip(double xmin, double ymin, double xmax, double ymax)
// {
// min.add_ip(-xmin, -ymin);
// max.add_ip(xmax, ymax);
// return this;
// }
//
//
// /**
// * Check if point is inside this rectangle
// *
// * @param point point to test
// * @return is inside
// */
// @Override
// public boolean isInside(VecValue point)
// {
// return Calc.inRange(point.x(), min.x(), max.x()) && Calc.inRange(point.y(), min.y(), max.y());
// }
//
//
// /**
// * Multiply in copy
// *
// * @param factor multiplier
// * @return offset copy
// */
// @Override
// public IRect mul(double factor)
// {
// return copy().mul_ip(factor);
// }
//
//
// /**
// * Multiply by number (useful for centered rects)
// *
// * @param x x multiplier
// * @param y y multiplier
// * @return copy multiplied
// */
// @Override
// public IRect mul(double x, double y)
// {
// return copy().mul_ip(x, y);
// }
//
//
// /**
// * Multiply coord in place
// *
// * @param factor multiplier
// * @return this
// */
// public IRect mul_ip(double factor)
// {
// min.mul_ip(factor);
// max.mul_ip(factor);
// return this;
// }
//
//
// /**
// * Multiply coord in place
// *
// * @param x multiplier x
// * @param y multiplier y
// * @return this
// */
// public IRect mul_ip(double x, double y)
// {
// min.mul_ip(x, y, 1);
// max.mul_ip(x, y, 1);
// return this;
// }
//
//
// /**
// * Round coords in copy
// *
// * @return copy, rounded
// */
// @Override
// public Rect round()
// {
// return new FixedRect(min.round(), max.round());
// }
//
//
// /**
// * Round this in place
// *
// * @return this
// */
// public IRect round_ip()
// {
// min.round_ip();
// max.round_ip();
// return this;
// }
//
//
// /**
// * Set to coordinates
// *
// * @param xmin lower x
// * @param ymin lower y
// * @param xmax upper x
// * @param ymax upper y
// */
// @Override
// public void setTo(double xmin, double ymin, double xmax, double ymax)
// {
// min.setTo(Math.min(xmin, xmax), Math.min(ymin, ymax));
// max.setTo(Math.max(xmin, xmax), Math.max(ymin, ymax));
// }
//
//
// /**
// * Set to other rect's coordinates
// *
// * @param r other rect
// */
// @Override
// public void setTo(Rect r)
// {
// min.setTo(r.min);
// max.setTo(r.max);
// }
//
//
// /**
// * Subtract X and Y from all coordinates in a copy
// *
// * @param x x to subtract
// * @param y y to subtract
// * @return copy changed
// */
// @Override
// public IRect sub(double x, double y)
// {
// return sub(new VecArith(x, y));
// }
//
//
// /**
// * Get offset copy (subtract)
// *
// * @param move offset vector
// * @return offset copy
// */
// @Override
// public IRect sub(VecMutable move)
// {
// return copy().sub_ip(move);
// }
//
//
// /**
// * Subtract X and Y from all coordinates in place
// *
// * @param x x to subtract
// * @param y y to subtract
// * @return this
// */
// public IRect sub_ip(double x, double y)
// {
// return sub_ip(new VecArith(x, y));
// }
//
//
// /**
// * Offset in place (subtract)
// *
// * @param move offset vector
// * @return this
// */
// public IRect sub_ip(VecMutable move)
// {
// min.sub_ip(move);
// max.sub_ip(move);
// return this;
// }
//
//
// @Override
// public String toString()
// {
// return String.format("[%s-%s]", min.toString(), max.toString());
// }
//
//
// /**
// * @return lower x
// */
// @Override
// public double xMin()
// {
// return min.x();
// }
//
//
// /**
// * @return upper x
// */
// @Override
// public double xMax()
// {
// return max.x();
// }
//
//
// /**
// * @return lower y
// */
// @Override
// public double yMin()
// {
// return min.y();
// }
//
//
// /**
// * @return upper y
// */
// @Override
// public double yMax()
// {
// return max.y();
// }
//
//
// @Override
// public double getHeight()
// {
// return max.y() - min.y();
// }
//
//
// @Override
// public double getWidth()
// {
// return max.x() - min.x();
// }
//
//
// /**
// * Get size (width, height) as (x,y)
// *
// * @return coord of width,height
// */
// public VecValue getSize()
// {
// return new VecArith(max.x() - min.x(), max.y() - min.y());
// }
//
//
// @Override
// public RectView getRect()
// {
// return this;
// }
//
//
// /**
// * Generate zero rect
// *
// * @return zero
// */
// public static IRect zero()
// {
// return ZERO.copy();
// }
//
//
// /**
// * Generate 0,0-1,1 rect
// *
// * @return one
// */
// public static IRect one()
// {
// return ZERO.copy();
// }
//}
Loading…
Cancel
Save