use of org.bimserver.models.geometry.Vector3f in project BIMserver by opensourceBIM.
the class TestGeometry method test.
@Test
public void test() {
try {
// Create a new BimServerClient with authentication
BimServerClientInterface bimServerClient = getFactory().create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
// Get the low level interface
LowLevelInterface lowLevelInterface = bimServerClient.getLowLevelInterface();
// Create a new project
SProject project = bimServerClient.getServiceInterface().addProject("test" + Math.random(), "ifc2x3tc1");
// Look for a deserializer
SDeserializerPluginConfiguration deserializer = bimServerClient.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
// Checkin file
long start = System.nanoTime();
bimServerClient.checkin(project.getOid(), "test", deserializer.getOid(), false, Flow.SYNC, new URL("https://github.com/opensourceBIM/TestFiles/raw/master/TestData/data/AC11-Institute-Var-2-IFC.ifc"));
// bimServerClient.checkin(project.getOid(), "test", deserializer.getOid(), false, Flow.SYNC, Paths.get("D:\\Dropbox\\Shared\\IFC files\\ArenA 2014\\3D IFC\\arena.ifc"));
long end = System.nanoTime();
System.out.println(((end - start) / 1000000) + " ms");
// Refresh project
project = bimServerClient.getServiceInterface().getProjectByPoid(project.getOid());
int nrTriangles = 0;
// Load model without lazy loading (complete model at once)
IfcModelInterface model = bimServerClient.getModel(project, project.getLastRevisionId(), true, true, true);
Assert.assertNotNull(model.getModelMetaData().getMinBounds());
Assert.assertNotNull(model.getModelMetaData().getMaxBounds());
for (IfcProduct ifcProduct : model.getAllWithSubTypes(IfcProduct.class)) {
GeometryInfo geometryInfo = ifcProduct.getGeometry();
if (geometryInfo != null) {
Vector3f minBounds = geometryInfo.getMinBounds();
Vector3f maxBounds = geometryInfo.getMinBounds();
Assert.assertNotNull(minBounds);
Assert.assertNotNull(maxBounds);
nrTriangles += geometryInfo.getPrimitiveCount();
}
}
Assert.assertEquals(45260, nrTriangles);
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.bimserver.models.geometry.Vector3f in project BIMserver by opensourceBIM.
the class OfflineGeometryGenerator method createVector3f.
private Vector3f createVector3f(PackageMetaData packageMetaData, IfcModelInterface model, double defaultValue) throws BimserverDatabaseException, IfcModelInterfaceException {
Vector3f vector3f = null;
vector3f = GeometryFactory.eINSTANCE.createVector3f();
vector3f.setX(defaultValue);
vector3f.setY(defaultValue);
vector3f.setZ(defaultValue);
return vector3f;
}
use of org.bimserver.models.geometry.Vector3f in project BIMserver by opensourceBIM.
the class GeometryGenerator method processExtendsUntranslated.
private void processExtendsUntranslated(GeometryInfo geometryInfo, float[] vertices, int index, GenerateGeometryResult generateGeometryResult2) throws BimserverDatabaseException {
double x = vertices[index];
double y = vertices[index + 1];
double z = vertices[index + 2];
Vector3f minBounds = geometryInfo.getMinBoundsUntranslated();
Vector3f maxBounds = geometryInfo.getMaxBoundsUntranslated();
minBounds.setX(Math.min(x, (double) minBounds.getX()));
minBounds.setY(Math.min(y, (double) minBounds.getY()));
minBounds.setZ(Math.min(z, (double) minBounds.getZ()));
maxBounds.setX(Math.max(x, (double) maxBounds.getX()));
maxBounds.setY(Math.max(y, (double) maxBounds.getY()));
maxBounds.setZ(Math.max(z, (double) maxBounds.getZ()));
}
Aggregations