use of com.ardor3d.math.Vector3 in project energy3d by concord-consortium.
the class Foundation method move.
public void move(final Vector3 d, final ArrayList<Vector3> movePoints) {
if (lockEdit) {
return;
}
if (selectedMesh != null) {
// if a mesh is selected, move the parent node
translateImportedNode(selectedMesh.getParent(), d.getX(), d.getY(), d.getZ());
draw();
drawMeshSelection(selectedMesh);
} else {
final List<Vector3> orgPoints = new ArrayList<Vector3>(movePoints.size());
for (int i = 0; i < points.size(); i++) {
orgPoints.add(points.get(i));
}
for (int i = 0; i < points.size(); i++) {
final Vector3 newP = movePoints.get(i).add(d, null);
points.set(i, newP);
if (i == points.size() - 1 && ensureDistanceFromOtherFoundations(newP, i) != newP) {
for (int j = 0; j < points.size(); j++) {
points.set(j, orgPoints.get(j));
}
return;
}
}
if (SceneManager.getInstance().getSelectedPart() == this) {
drawAzimuthArrow();
}
draw();
drawChildren();
updateHandlesOfAllFoudations();
}
updateImportedNodePositionsAfterMove();
}
use of com.ardor3d.math.Vector3 in project energy3d by concord-consortium.
the class Foundation method setEditPoint.
@Override
public void setEditPoint(int editPoint) {
if (!resizeHouseMode && editPoint > 3 && editPoint < 8) {
editPoint -= 4;
}
// super.setEditPoint(editPoint);
editPointIndex = editPoint;
if (editPoint < 8) {
drawCompleted = false;
}
if (!resizeHouseMode) {
saveOrgPoints();
minX = Double.MAX_VALUE;
minY = Double.MAX_VALUE;
maxX = -Double.MAX_VALUE;
maxY = -Double.MAX_VALUE;
for (final HousePart part : children) {
if (part.children.size() > 2 && part.getPoints().size() > 1) {
final Vector3 p1 = part.getAbsPoint(0);
final Vector3 p2 = part.getAbsPoint(2);
minX = Math.min(p1.getX(), minX);
minX = Math.min(p2.getX(), minX);
minY = Math.min(p1.getY(), minY);
minY = Math.min(p2.getY(), minY);
maxX = Math.max(p1.getX(), maxX);
maxX = Math.max(p2.getX(), maxX);
maxY = Math.max(p1.getY(), maxY);
maxY = Math.max(p2.getY(), maxY);
} else {
// if the child is a solar panel, a rack, or a mirror
final Vector3 p1 = part.getAbsPoint(0);
minX = Math.min(p1.getX(), minX);
minY = Math.min(p1.getY(), minY);
maxX = Math.max(p1.getX(), maxX);
maxY = Math.max(p1.getY(), maxY);
}
}
}
}
use of com.ardor3d.math.Vector3 in project energy3d by concord-consortium.
the class Foundation method reverseFoundationResizeEffect.
private void reverseFoundationResizeEffect(final HousePart child, final double dx, final double dxOrg, final double ratioX, final double dy, final double dyOrg, final double ratioY) {
for (final Vector3 childPoint : child.getPoints()) {
double x = childPoint.getX() / ratioX;
if (editPointIndex == 0 || editPointIndex == 1) {
x += (dx - dxOrg) / dx;
}
childPoint.setX(x);
double y = childPoint.getY() / ratioY;
if (editPointIndex == 0 || editPointIndex == 2) {
y += (dy - dyOrg) / dy;
}
childPoint.setY(y);
}
}
use of com.ardor3d.math.Vector3 in project energy3d by concord-consortium.
the class Foundation method getNearestParabolicTrough.
public ParabolicTrough getNearestParabolicTrough(final ParabolicTrough trough) {
if (trough.getTopContainer() != this) {
return null;
}
final List<ParabolicTrough> troughs = getParabolicTroughs();
if (troughs.isEmpty() || (troughs.size() == 1 && troughs.get(0) == trough)) {
return null;
}
ParabolicTrough nearest = null;
double dmin = Double.MAX_VALUE;
final Vector3 o = trough.getAbsCenter();
double d;
for (final ParabolicTrough t : troughs) {
if (t != trough) {
d = t.getAbsCenter().distanceSquared(o);
if (d < dmin) {
dmin = d;
nearest = t;
}
}
}
troughs.clear();
return nearest;
}
use of com.ardor3d.math.Vector3 in project energy3d by concord-consortium.
the class Foundation method getNearestFresnelReflector.
public FresnelReflector getNearestFresnelReflector(final FresnelReflector reflector) {
if (reflector.getTopContainer() != this) {
return null;
}
final List<FresnelReflector> reflectors = getFresnelReflectors();
if (reflectors.isEmpty() || (reflectors.size() == 1 && reflectors.get(0) == reflector)) {
return null;
}
FresnelReflector nearest = null;
double dmin = Double.MAX_VALUE;
final Vector3 o = reflector.getAbsCenter();
double d;
for (final FresnelReflector r : reflectors) {
if (r != reflector) {
d = r.getAbsCenter().distanceSquared(o);
if (d < dmin) {
dmin = d;
nearest = r;
}
}
}
reflectors.clear();
return nearest;
}
Aggregations