Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>virtual-cardboard</groupId>
<artifactId>nengen</artifactId>
<version>0.0.7</version>
<version>0.0.8</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
23 changes: 21 additions & 2 deletions src/main/java/visuals/constraint/box/ConstraintCoordinate.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ public ConstraintCoordinate translate(Constraint x, Constraint y) {
return new ConstraintCoordinate(this.x.add(x), this.y.add(y));
}

@Deprecated
public ConstraintCoordinate translate(float x, float y) {
return translate(absolute(x), absolute(y));
}

@Deprecated
public ConstraintCoordinate translate(Vector2f v) {
return translate(v.x(), v.y());
}

@Deprecated
public ConstraintCoordinate translate(ConstraintCoordinate c) {
return translate(c.x, c.y);
}
Expand All @@ -59,8 +62,24 @@ public ConstraintCoordinate subtract(Vector2f v) {
return translate(v.negate());
}

public ConstraintCoordinate multiply(float f) {
return new ConstraintCoordinate(x.multiply(f), y.multiply(f));
public ConstraintSize scale(float f) {
return scale(f, f);
}

public ConstraintSize scale(float f1, float f2) {
return new ConstraintSize(x.multiply(f1), x.multiply(f2));
}

public ConstraintSize add(ConstraintSize other) {
return add(other.w(), other.h());
}

public ConstraintSize add(Vector2f v) {
return add(absolute(v.x()), absolute(v.y()));
}

public ConstraintSize add(Constraint cw, Constraint ch) {
return new ConstraintSize(x.add(cw), x.add(ch));
}

public ConstraintCoordinate neg() {
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/visuals/constraint/box/ConstraintSize.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ public Constraint h() {
}

public ConstraintSize scale(float f) {
return new ConstraintSize(w.multiply(f), h.multiply(f));
return scale(f, f);
}

public ConstraintSize scale(float f1, float f2) {
return new ConstraintSize(w.multiply(f1), h.multiply(f2));
}

public ConstraintSize add(ConstraintSize other) {
return new ConstraintSize(w.add(other.w), h.add(other.h));
return add(other.w(), other.h());
}

public ConstraintSize add(Constraint cw, Constraint ch) {
return new ConstraintSize(w.add(cw), h.add(ch));
}

public ConstraintSize neg() {
Expand Down