chore: rename invariant to condition
This commit is contained in:
parent
e2469b1e31
commit
8629ea34a9
|
@ -1,6 +1,6 @@
|
||||||
package ma2tetr.invariant;
|
package ma2tetr.condition;
|
||||||
|
|
||||||
public abstract class AbstractInvariant {
|
public abstract class AbstractCondition {
|
||||||
|
|
||||||
private double accuracy = 0.00000000001;
|
private double accuracy = 0.00000000001;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package ma2tetr.invariant;
|
package ma2tetr.condition;
|
||||||
|
|
||||||
import ma2tetr.model.Coords3D;
|
import ma2tetr.model.Coords3D;
|
||||||
|
|
||||||
public class EquilateralTriangleInvariant extends AbstractInvariant {
|
public class EquilateralTriangleCondition extends AbstractCondition {
|
||||||
|
|
||||||
private Coords3D p1;
|
private Coords3D p1;
|
||||||
private Coords3D p2;
|
private Coords3D p2;
|
||||||
|
@ -12,7 +12,7 @@ public class EquilateralTriangleInvariant extends AbstractInvariant {
|
||||||
private double len23;
|
private double len23;
|
||||||
private double len13;
|
private double len13;
|
||||||
|
|
||||||
public EquilateralTriangleInvariant(Coords3D p1, Coords3D p2, Coords3D p3) {
|
public EquilateralTriangleCondition(Coords3D p1, Coords3D p2, Coords3D p3) {
|
||||||
this.p1 = p1;
|
this.p1 = p1;
|
||||||
this.p2 = p2;
|
this.p2 = p2;
|
||||||
this.p3 = p3;
|
this.p3 = p3;
|
|
@ -1,16 +1,16 @@
|
||||||
package ma2tetr.invariant;
|
package ma2tetr.condition;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import ma2tetr.model.Coords3D;
|
import ma2tetr.model.Coords3D;
|
||||||
|
|
||||||
public class RadiusInvariant extends AbstractInvariant {
|
public class RadiusCondition extends AbstractCondition {
|
||||||
|
|
||||||
private Set<Coords3D> points;
|
private Set<Coords3D> points;
|
||||||
private Coords3D center;
|
private Coords3D center;
|
||||||
private double radius;
|
private double radius;
|
||||||
|
|
||||||
public RadiusInvariant(Set<Coords3D> points, Coords3D center, double radius) {
|
public RadiusCondition(Set<Coords3D> points, Coords3D center, double radius) {
|
||||||
this.points = points;
|
this.points = points;
|
||||||
this.center = center;
|
this.center = center;
|
||||||
this.radius = radius;
|
this.radius = radius;
|
|
@ -1,9 +1,9 @@
|
||||||
package ma2tetr.invariant;
|
package ma2tetr.condition;
|
||||||
|
|
||||||
import ma2tetr.model.Coords3D;
|
import ma2tetr.model.Coords3D;
|
||||||
import ma2tetr.model.Tetrahedron;
|
import ma2tetr.model.Tetrahedron;
|
||||||
|
|
||||||
public class TetrahedronInvariant extends AbstractInvariant {
|
public class TetrahedronCondition extends AbstractCondition {
|
||||||
|
|
||||||
private Coords3D top;
|
private Coords3D top;
|
||||||
private Coords3D p1;
|
private Coords3D p1;
|
||||||
|
@ -15,17 +15,17 @@ public class TetrahedronInvariant extends AbstractInvariant {
|
||||||
private double len3;
|
private double len3;
|
||||||
private double lenbase;
|
private double lenbase;
|
||||||
|
|
||||||
private EquilateralTriangleInvariant base;
|
private EquilateralTriangleCondition base;
|
||||||
|
|
||||||
public TetrahedronInvariant(Coords3D top, Coords3D p1, Coords3D p2, Coords3D p3) {
|
public TetrahedronCondition(Coords3D top, Coords3D p1, Coords3D p2, Coords3D p3) {
|
||||||
this.top = top;
|
this.top = top;
|
||||||
this.p1 = p1;
|
this.p1 = p1;
|
||||||
this.p2 = p2;
|
this.p2 = p2;
|
||||||
this.p3 = p3;
|
this.p3 = p3;
|
||||||
this.base = new EquilateralTriangleInvariant(p1, p2, p3);
|
this.base = new EquilateralTriangleCondition(p1, p2, p3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TetrahedronInvariant(Tetrahedron t) {
|
public TetrahedronCondition(Tetrahedron t) {
|
||||||
this(t.getTop(), t.getP1(), t.getP2(), t.getP3());
|
this(t.getTop(), t.getP1(), t.getP2(), t.getP3());
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import ma2tetr.api.ITetrahedronCoordCalculator;
|
import ma2tetr.api.ITetrahedronCoordCalculator;
|
||||||
import ma2tetr.invariant.RadiusInvariant;
|
import ma2tetr.condition.RadiusCondition;
|
||||||
import ma2tetr.invariant.TetrahedronInvariant;
|
import ma2tetr.condition.TetrahedronCondition;
|
||||||
import ma2tetr.model.Coords3D;
|
import ma2tetr.model.Coords3D;
|
||||||
import ma2tetr.model.IterationState;
|
import ma2tetr.model.IterationState;
|
||||||
import ma2tetr.model.Point3D;
|
import ma2tetr.model.Point3D;
|
||||||
|
@ -38,9 +38,9 @@ public class TetrahedronMovingCalculator implements ITetrahedronCoordCalculator
|
||||||
points.add(triangle.getP2());
|
points.add(triangle.getP2());
|
||||||
points.add(triangle.getP3());
|
points.add(triangle.getP3());
|
||||||
StateLogger logger = new StateLogger(center, points, log);
|
StateLogger logger = new StateLogger(center, points, log);
|
||||||
RadiusInvariant rinv = new RadiusInvariant(points, center, radius);
|
RadiusCondition rinv = new RadiusCondition(points, center, radius);
|
||||||
rinv.setAccuracy(accuracy);
|
rinv.setAccuracy(accuracy);
|
||||||
TetrahedronInvariant tinv = new TetrahedronInvariant(top, triangle.getP1(), triangle.getP2(), triangle.getP3());
|
TetrahedronCondition tinv = new TetrahedronCondition(top, triangle.getP1(), triangle.getP2(), triangle.getP3());
|
||||||
tinv.setAccuracy(accuracy);
|
tinv.setAccuracy(accuracy);
|
||||||
double scaling = radius / 10;
|
double scaling = radius / 10;
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
|
@ -4,8 +4,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import ma2tetr.api.ITetrahedronCoordCalculator;
|
import ma2tetr.api.ITetrahedronCoordCalculator;
|
||||||
import ma2tetr.invariant.RadiusInvariant;
|
import ma2tetr.condition.RadiusCondition;
|
||||||
import ma2tetr.invariant.TetrahedronInvariant;
|
import ma2tetr.condition.TetrahedronCondition;
|
||||||
import ma2tetr.model.Coords3D;
|
import ma2tetr.model.Coords3D;
|
||||||
import ma2tetr.model.IterationState;
|
import ma2tetr.model.IterationState;
|
||||||
import ma2tetr.model.Point3D;
|
import ma2tetr.model.Point3D;
|
||||||
|
@ -29,9 +29,9 @@ public class TetrahedronScalingCalculator implements ITetrahedronCoordCalculator
|
||||||
Coords3D center = new Vector3D(0, 0, 0);
|
Coords3D center = new Vector3D(0, 0, 0);
|
||||||
tetrahedron = new Tetrahedron(new Point3D(0, radius, 0), accuracy);
|
tetrahedron = new Tetrahedron(new Point3D(0, radius, 0), accuracy);
|
||||||
StateLogger logger = new StateLogger(center, tetrahedron.getPointsSet(), log);
|
StateLogger logger = new StateLogger(center, tetrahedron.getPointsSet(), log);
|
||||||
TetrahedronInvariant tinv = new TetrahedronInvariant(tetrahedron);
|
TetrahedronCondition tinv = new TetrahedronCondition(tetrahedron);
|
||||||
tinv.setAccuracy(accuracy);
|
tinv.setAccuracy(accuracy);
|
||||||
RadiusInvariant rinv = new RadiusInvariant(tetrahedron.getPointsSet(), center, radius);
|
RadiusCondition rinv = new RadiusCondition(tetrahedron.getPointsSet(), center, radius);
|
||||||
rinv.setAccuracy(accuracy);
|
rinv.setAccuracy(accuracy);
|
||||||
double scaling = radius / 10;
|
double scaling = radius / 10;
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package ma2tetr.model;
|
package ma2tetr.model;
|
||||||
|
|
||||||
import ma2tetr.invariant.EquilateralTriangleInvariant;
|
import ma2tetr.condition.EquilateralTriangleCondition;
|
||||||
|
|
||||||
public class TetrahedronBuilder {
|
public class TetrahedronBuilder {
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public class TetrahedronBuilder {
|
||||||
p1 = trib.getP1();
|
p1 = trib.getP1();
|
||||||
p2 = trib.getP2();
|
p2 = trib.getP2();
|
||||||
p3 = trib.getP3();
|
p3 = trib.getP3();
|
||||||
EquilateralTriangleInvariant inv = new EquilateralTriangleInvariant(p1, p2, p3);
|
EquilateralTriangleCondition inv = new EquilateralTriangleCondition(p1, p2, p3);
|
||||||
inv.setAccuracy(accuracy);
|
inv.setAccuracy(accuracy);
|
||||||
if (!inv.isFulfilled()) {
|
if (!inv.isFulfilled()) {
|
||||||
throw new RuntimeException("Unexpected error");
|
throw new RuntimeException("Unexpected error");
|
||||||
|
|
Loading…
Reference in a new issue