-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Hello,
i have a problem with the shape with holes extrusion.
I created a shape with a hole inside. But i have a console error : SEVERE: ShapeUtils: removeHoles() ERROR (but not at any time).
My code :
public static Shape computeShape ( final PWPModelProduct p_product )
{
PWPModelLevel level;
Shape shape;
List< Vector2 > arrPoint;
final int xMin, xMax, yMin, yMax;
// ------------ DECLARE ------------//
level = p_product.getLevel();
shape = new Shape();
arrPoint = new ArrayList< >();
xMin = p_product.getOffsetLeft();
xMax = level.getWallWidth() - p_product.getOffsetRight();
yMin = level.getPlinthHeight() + p_product.getOffsetBottom();
yMax = level.getWallHeight() - level.getCorniceHeight() - p_product.getOffsetTop();
// ------------- INIT --------------//
arrPoint.add( new Vector2( xMin, yMin ) );
arrPoint.add( new Vector2( xMax, yMin ) );
arrPoint.add( new Vector2( xMax, yMax ) );
arrPoint.add( new Vector2( xMin, yMax ) );
shape.fromPoints( arrPoint );
PWPManagerProduct.computeHoles( shape, level.getArrFurniture(), p_product.getOffsetFurniture() );
return shape;
}
private static void computeHoles ( final Shape p_shape, final List< PWPModelFurniture > p_arrFurniture,
final int p_offset )
{
List< Path > arrHole;
Path hole;
List< Vector2 > arrPoint;
int xMin, xMax, yMin, yMax;
// ------------ DECLARE ------------//
arrHole = p_shape.getHoles();
// ------------- INIT --------------//
for ( final PWPModelFurniture furniture : p_arrFurniture )
{
// Create bbox.
xMin = (int)furniture.getPosition().getX() - p_offset;
xMax = (int)furniture.getPosition().getX() + furniture.getWidth() + p_offset;
yMin = (int)furniture.getPosition().getY() - p_offset;
yMax = (int)furniture.getPosition().getY() + furniture.getHeight() + p_offset;
arrPoint = new ArrayList< >();
arrPoint.add( new Vector2( xMin, yMin ) );
arrPoint.add( new Vector2( xMax, yMin ));
arrPoint.add( new Vector2( xMax, yMax ));
arrPoint.add( new Vector2( xMin, yMax ) );
hole = new Path( arrPoint );
// Add to holes list.
arrHole.add( hole );
}
}
Then i create a geometry with this shape and the error occurs.
ExtrudeGeometryParameters param;
MeshPhongMaterial mat;
// ------------ DECLARE ------------//
param = new ExtrudeGeometryParameters();
mat = new MeshPhongMaterial();
// ------------- INIT --------------//
param.bevelEnabled = false;
param.amount = 1;
this.setGeometry( p_shape.extrude( param ) );
Note that the 3D result sometimes seems ok, sometimes not.
Then, if my hole is over a shape edge, i have another message: WARNING: FontUtils: triangulate() - Warning, unable to triangulate polygon!
In this case, the 3D result is always wrong.
EDIT: Some screen shots
Reactions are currently unavailable


