@@ -655,6 +655,51 @@ Manifold Manifold::CalculateCurvature(int gaussianIdx, int meanIdx) const {
655
655
return Manifold (std::make_shared<CsgLeafNode>(pImpl));
656
656
}
657
657
658
+ /* *
659
+ * Fills in vertex properties for normal vectors, calculated from the mesh
660
+ * geometry. Flat faces composed of three or more triangles will remain flat.
661
+ *
662
+ * @param normalIdx The property channel in which to store the X
663
+ * values of the normals. The X, Y, and Z channels will be sequential. The
664
+ * property set will be automatically expanded to include up through normalIdx
665
+ * + 2.
666
+ *
667
+ * @param minSharpAngle Any edges with angles greater than this value will
668
+ * remain sharp, getting different normal vector properties on each side of the
669
+ * edge. By default, no edges are sharp and all normals are shared. With a value
670
+ * of zero, the model is faceted and all normals match their triangle normals,
671
+ * but in this case it would be better not to calculate normals at all.
672
+ */
673
+ Manifold Manifold::CalculateNormals (int normalIdx, float minSharpAngle) const {
674
+ auto pImpl = std::make_shared<Impl>(*GetCsgLeafNode ().GetImpl ());
675
+ pImpl->SetNormals (normalIdx, minSharpAngle);
676
+ return Manifold (std::make_shared<CsgLeafNode>(pImpl));
677
+ }
678
+
679
+ /* *
680
+ * Smooths out the Manifold by filling in the halfedgeTangent vectors. The
681
+ * geometry will remain unchanged until Refine or RefineToLength is called to
682
+ * interpolate the surface.
683
+ *
684
+ * @param minSharpAngle degrees, default 60. Any edges with angles greater than
685
+ * this value will remain sharp. The rest will be smoothed to G1 continuity,
686
+ * with the caveat that flat faces of three or more triangles will always remain
687
+ * flat. With a value of zero, the model is faceted, but in this case there is
688
+ * no point in smoothing.
689
+ *
690
+ * @param minSmoothness range: 0 - 1, default 0. The smoothness applied to sharp
691
+ * angles. The default gives a hard edge, while values > 0 will give a small
692
+ * fillet on these sharp edges. A value of 1 is equivalent to a minSharpAngle of
693
+ * 180 - all edges will be smooth.
694
+ */
695
+ Manifold Manifold::SmoothOut (float minSharpAngle, float minSmoothness) const {
696
+ auto pImpl = std::make_shared<Impl>(*GetCsgLeafNode ().GetImpl ());
697
+ if (!IsEmpty ()) {
698
+ pImpl->CreateTangents (pImpl->SharpenEdges (minSharpAngle, minSmoothness));
699
+ }
700
+ return Manifold (std::make_shared<CsgLeafNode>(pImpl));
701
+ }
702
+
658
703
/* *
659
704
* Increase the density of the mesh by splitting every edge into n pieces. For
660
705
* instance, with n = 2, each triangle will be split into 4 triangles. These
0 commit comments