privatefinaldoubleNEIGHBOURHOOD_DISTANCE=100;//squared for efficiency
/**
* Constructor
*/
publicGlyphCalculator(){
}
@Override
publicbooleanisThreadSafe(){
returnfalse;
}
@Override
publicvoidvisitMeshFacet(MeshFacetfacet){
facets.add(facet);
}
/**
* Chooses vertices to become glyphs and calculates their principal curvatures.
* Based on
* <a href="https://ieeexplore.ieee.org/document/597794">V. Interrante et al.: Conveying the 3D shape of smoothly curving transparent surfaces via texture</a>,
* 1997, doi: 10.1109/2945.597794
*
* @param maxSamples maximum number of glyphs to be calculated, passed to a subsampler.
@@ -228,7 +229,7 @@ public class MeshTriangle implements Iterable<MeshPoint>, Serializable {
/**
* Computes the point laying on the triangle which is closest to
* given 3D point. Return point is either one of the tringle's vertices,
* given 3D point. Return point is either one of the triangle's vertices,
* a point laying on triangles edge, or a point laying on the plane of
* the triangle inside the triangle boundaries.
*
@@ -328,7 +329,7 @@ public class MeshTriangle implements Iterable<MeshPoint>, Serializable {
/**
* Return a center of circumcircle. This point represents the point
* of Voronoi area used for Delaunay triangulation, for instence.
* of Voronoi area used for Delaunay triangulation, for instance.
*
* @return the center of circumcircle
*/
@@ -804,4 +805,55 @@ public class MeshTriangle implements Iterable<MeshPoint>, Serializable {
doublet=oa.dot(v)+ab.dot(v)*s;
return(t>=0);
}
/**
* Function tests if the mesh triangle is closer to the sample point than a certain distance and if is, calculates
* the second fundamental form of the sample point regarding the plane defined by the mesh triangle, otherwise
* returns null.
* <p>
* For more details, see:
* <a href="https://ieeexplore.ieee.org/document/597794">V. Interrante et al.: Conveying the 3D shape of smoothly curving transparent surfaces via texture</a>,
* 1997, doi: 10.1109/2945.597794
* </p>
*
* @param samplePosition position of a point on model's surface selected to be a glyph
* @param distanceAccepted squared distance; the triangle needs to be closer to the sample point than this distance
* to be taken into account
* @param base1 first vector of orthogonal base; the base consists of three vectors: the normal of the sample point
* and two vectors(base1 and base2) defining the tangent plane of the model at the sample point
* @param base2 second vector of orthogonal base; the base consists of three vectors: the normal of the sample point
* and two vectors(base1 and base2) defining the tangent plane of the model at the sample point
* @return curvature of the sample point represented by the rate the surface normal tips in the directions of