package org.jcae.opencascade.jni; import static org.junit.Assert.*; import org.junit.Test; public class Curvature { /** Example to show how to get the curvature of a surface */ @Test public void sample() { //Create an cone for the example double[] axis=new double[]{ 0, 0, 0, 1, 2, 3 }; TopoDS_Shape shape=new BRepPrimAPI_MakeCone( axis, 3, 1, 4, Math.PI*2).shape(); // Select the side of the cone TopExp_Explorer exp=new TopExp_Explorer(shape, TopAbs_ShapeEnum.FACE); TopoDS_Face face=(TopoDS_Face) exp.current(); // Get the geometry associated to the previously selected face Geom_Surface geom = BRep_Tool.surface(face); // Get parameters intervals double[] paramBounds=new double[4]; geom.bounds(paramBounds); double umin=paramBounds[0]; double umax=paramBounds[1]; double vmin=paramBounds[2]; double vmax=paramBounds[3]; // Handle the case of infinite geometry if(!geom.isUClosed()) { umin=0; umax=1; } if(!geom.isVClosed()) { vmin=0; vmax=1; } // Create the object which allow to ask for various local geometry // properties GeomLProp_SLProps props=new GeomLProp_SLProps(2, 1E-7); props.setSurface(geom); // Iterate on u and v and display various properties at each point double ustep=(umax-umin)/10; double vstep=(vmax-vmin)/10; for(double u=umin; u