use of org.bimserver.models.ifc2x3tc1.IfcCartesianPoint in project BIMserver by opensourceBIM.
the class IfcUtils method getAbsolutePosition.
/**
* Not finished, does not take into account the directions
*
* @param ifcObjectPlacement
* @return
* @throws PlacementNotImplementedException
*/
public static double[] getAbsolutePosition(IfcObjectPlacement ifcObjectPlacement) throws PlacementNotImplementedException {
if (ifcObjectPlacement instanceof IfcGridPlacement) {
throw new PlacementNotImplementedException("IfcGridPlacement has not been implemented");
} else if (ifcObjectPlacement instanceof IfcLocalPlacement) {
IfcLocalPlacement ifcLocalPlacement = (IfcLocalPlacement) ifcObjectPlacement;
IfcAxis2Placement relativePlacement = ifcLocalPlacement.getRelativePlacement();
if (relativePlacement instanceof IfcAxis2Placement2D) {
throw new PlacementNotImplementedException("IfcAxis2Placement2D has not been implemented");
} else if (relativePlacement instanceof IfcAxis2Placement3D) {
IfcAxis2Placement3D ifcAxis2Placement3D = (IfcAxis2Placement3D) relativePlacement;
IfcObjectPlacement placementRelativeTo = ifcLocalPlacement.getPlacementRelTo();
if (placementRelativeTo == null) {
IfcCartesianPoint ifcCartesianPoint = ifcAxis2Placement3D.getLocation();
return new double[] { ifcCartesianPoint.getCoordinates().get(0), ifcCartesianPoint.getCoordinates().get(1), ifcCartesianPoint.getCoordinates().get(2) };
} else {
double[] relative = getAbsolutePosition(placementRelativeTo);
IfcCartesianPoint ifcCartesianPoint = ifcAxis2Placement3D.getLocation();
return new double[] { relative[0] + ifcCartesianPoint.getCoordinates().get(0), relative[1] + ifcCartesianPoint.getCoordinates().get(1), relative[2] + ifcCartesianPoint.getCoordinates().get(2) };
}
}
}
return new double[] { 0d, 0d, 0d };
}
use of org.bimserver.models.ifc2x3tc1.IfcCartesianPoint in project BIMserver by opensourceBIM.
the class IfcUtils method getBoundingBox2D.
public static AxisAlignedBoundingBox2D getBoundingBox2D(List<IfcCartesianPoint> points) throws GeometryException {
AxisAlignedBoundingBox2D box2d = new AxisAlignedBoundingBox2D();
for (IfcCartesianPoint ifcCartesianPoint : points) {
EList<Double> coordinates = ifcCartesianPoint.getCoordinates();
if (coordinates.size() > 2) {
throw new GeometryException("Too many dimensions (" + coordinates.size() + ") for 2D boundingbox");
}
box2d.process(coordinates);
}
return box2d;
}
Aggregations