All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.skjolber.packing.ep.points3d.DefaultYZPlanePoint3D Maven / Gradle / Ivy

There is a newer version: 3.0.9
Show newest version
package com.github.skjolber.packing.ep.points3d;

import java.util.ArrayList;
import java.util.List;

import com.github.skjolber.packing.api.Placement3D;
import com.github.skjolber.packing.api.ep.Point3D;
import com.github.skjolber.packing.api.ep.YZPlanePoint3D;

public class DefaultYZPlanePoint3D

extends Point3D

implements YZPlanePoint3D { /** range constrained to current minX */ private final P yzPlane; public DefaultYZPlanePoint3D( int minX, int minY, int minZ, int maxX, int maxY, int maxZ, P yzPlane ) { super(minX, minY, minZ, maxX, maxY, maxZ); this.yzPlane = yzPlane; } public int getSupportedYZPlaneMinY() { return yzPlane.getAbsoluteY(); } public int getSupportedYZPlaneMaxY() { return yzPlane.getAbsoluteEndY(); } @Override public int getSupportedYZPlaneMinZ() { return yzPlane.getAbsoluteZ(); } @Override public int getSupportedYZPlaneMaxZ() { return yzPlane.getAbsoluteEndZ(); } @Override public boolean isSupportedYZPlane(int y, int z) { return yzPlane.getAbsoluteY() <= y && y <= yzPlane.getAbsoluteEndY() && yzPlane.getAbsoluteZ() <= z && z <= yzPlane.getAbsoluteEndZ(); } public boolean isYZPlaneEdgeZ(int z) { return yzPlane.getAbsoluteEndZ() == z - 1; } public boolean isYZPlaneEdgeY(int y) { return yzPlane.getAbsoluteEndY() == y - 1; } @Override public Placement3D getYZPlane() { return yzPlane; } @Override public Point3D

clone(int maxX, int maxY, int maxZ) { return new DefaultYZPlanePoint3D<>( minX, minY, minZ, maxX, maxY, maxZ, yzPlane ); } @Override public List

getPlacements3D() { List

list = new ArrayList<>(); list.add(yzPlane); return list; } @Override public List

getPlacements2D() { List

list = new ArrayList<>(); list.add(yzPlane); return list; } @Override public DefaultYZPlanePoint3D

clone() { return new DefaultYZPlanePoint3D<>(minX, minY, minZ, maxX, maxY, maxZ, yzPlane); } @Override public Point3D

moveX(int x, int maxX, int maxY, int maxZ) { // xzPlane support is lost return new DefaultPoint3D<>(x, minY, minZ, maxX, maxY, maxZ); } @Override public Point3D

moveX(int x, int maxX, int maxY, int maxZ, P yzSupport) { // xzPlane support is lost return new DefaultYZPlanePoint3D<>(x, minY, minZ, maxX, maxY, maxZ, yzSupport); } @Override public Point3D

moveY(int y, int maxX, int maxY, int maxZ) { // xzPlane support is lost if(y <= yzPlane.getAbsoluteEndY()) { return new DefaultYZPlanePoint3D<>(minX, y, minZ, maxX, maxY, maxZ, yzPlane); } return new DefaultPoint3D<>(minX, y, minZ, maxX, maxY, maxZ); } @Override public Point3D

moveY(int y, int maxX, int maxY, int maxZ, P xzSupport) { // xzPlane support is lost if(y <= yzPlane.getAbsoluteEndY()) { return new DefaultXZPlaneYZPlanePoint3D<>(minX, y, minZ, maxX, maxY, maxZ, xzSupport, yzPlane); } return new DefaultXZPlanePoint3D<>(minX, y, minZ, maxX, maxY, maxZ, xzSupport); } @Override public Point3D

moveZ(int z, int maxX, int maxY, int maxZ) { if(z <= yzPlane.getAbsoluteEndZ()) { return new DefaultYZPlanePoint3D<>(minX, minY, z, maxX, maxY, maxZ, yzPlane); } // all previous plane support is lost return new DefaultPoint3D<>(minX, minY, z, maxX, maxY, maxZ); } @Override public Point3D

moveZ(int z, int maxX, int maxY, int maxZ, P xySupport) { if(z <= yzPlane.getAbsoluteEndZ()) { return new DefaultXYPlaneYZPlanePoint3D<>(minX, minY, z, maxX, maxY, maxZ, yzPlane, xySupport); } // all previous plane support is lost return new DefaultXYPlanePoint3D<>(minX, minY, z, maxX, maxY, maxZ, xySupport); } /** * Rotate box, i.e. in 3D * * @return this instance */ @Override public Point3D

rotate() { return new DefaultPoint3D<>(minY, minZ, minX, maxY, maxZ, maxX); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy