Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
### Added
- `smlib_blend` and `smlib_fillet` blend a convex and a concave edge that continue each other tangentially at a vertex across a tangent seam, such as a bar's front top edge and the concave arc where its top runs into a cylinder, or the same part with drafted walls. The corner is two faces tangent to both blends and to the walls, smooth inside; it used to fold or fail. ([smlib #82](https://github.com/tangency-labs/smlib/issues/82))

### Changed
- `smlib_fillet` ends a round selected on part of a tangent chain at the smooth vertex where its edge runs on into an edge that is not rounded, on the plane square to its edge there, instead of failing.
- `smlib_fillet` refuses a round whose contact line runs past its side edge, or passes over the side edge of the other convexity where a concave round ends on a face, with `SMLIB_ERR_NO_ROOM`, and `smlib_blend_fit_size` names the largest radius whose contact line still ends on that edge. It used to fail with a corner error.
- `smlib_fillet` no longer depends on where a cylinder's seam meets a side edge: the round's contact line is followed across the seam's vertex onto the next edge of the same two faces. A boss tilted 40 degrees into a plate now rounds; it used to be refused with a size that came from the seam's position.

### Fixed
- The C API's flat B-rep arrays (`smlib_brep_export` / `smlib_brep_import`) carry a Ball corner's
`SmBallPatch` as itself. It used to be written as a bare NURBS and read back as an
Expand Down
17 changes: 17 additions & 0 deletions capi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1342,3 +1342,20 @@ This fork changes upstream SMLib (NVIDIA usd-brep, Apache-2.0) as follows:
temporary full circle, whose closed-curve rule turned an open arc ending 1.17e-6 degrees short of
360 into 360, its analytic domain then 1.45e-8 off its NURB (SmEllipse test 1). Only a closed NURB
takes that rule now.
- **A round ending at a smooth vertex** (`SmBlendCornerEnd.cpp`, `SM_BEND_AT_SMOOTH`): a round
selected on part of a tangent chain, whose edge runs on tangentially into an edge of its
convexity that is not rounded, ends there on the plane through the vertex square to its edge,
capped by a plane face. Upstream did not end it there: the End took the tangent edge for its
side edge, or the corner failed.
- **A rail past its side edge is refused, naming its size** (`SmBlendCornerEnd.cpp`,
`RadiusReachingSideEdgeEnd`, `RefuseEndOverflowingSideEdge`; `SmFilletExecutive.cpp`): a rail
that runs past its side edge's far end, or a concave round whose rail passes over the side edge
of the other convexity at a mixed End (the round would add material over the end face), is
refused `SMLIB_ERR_NO_ROOM`, naming the largest radius whose rail still ends on that edge (less
the part's tolerance where the bound is open), instead of failing with a corner error.
- **A side edge continued across a seam's vertex** (`SmBlendCorner.cpp`,
`sm_SideEdgeuseAcrossSeamVertex`; `SmFilletGeom.cpp`, `SmFilletVertex::CalcRailIntEdgeuse`,
`SmFilletEdge::CalcEdgeOnEdge`): where a periodic face's seam ends on a side edge and nothing
else meets it there, the rail's end is looked for on the next edge too, and the round's end
takes in the seam's vertex. Upstream looked on the first edge only, so whether a round built
depended on where a cylinder's seam fell. A real edge at that vertex is still a corner.
920 changes: 797 additions & 123 deletions capi/tests/ops_kernel.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/generic-blend.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ The rework lands in seven steps, each behind tests committed failing first.
| 1 | the tangent end as an event; the end rib built outward, order 2 in t = √s; the march into P deleted | merged, [smlib #76](https://github.com/tangency-labs/smlib/pull/76) |
| 2 | one classification of the exact rounds, each built as its rational surface; the try-chain deleted | merged, [smlib #77](https://github.com/tangency-labs/smlib/pull/77) |
| 3 | one Gⁿ section generator (chord, circle, curvature) certified per span; variable rounds as the union of their balls | merged, [smlib #78](https://github.com/tangency-labs/smlib/pull/78) |
| 4 | corners: Turn (Mitre, Swept), Join, Ball, End ([#79](https://github.com/tangency-labs/smlib/pull/79)); Setback with its certified convex fill ([#104](https://github.com/tangency-labs/smlib/pull/104)); the Ball on cylinders, cones and spheres ([#110](https://github.com/tangency-labs/smlib/pull/110)); the unreachable old corner code deleted ([#113](https://github.com/tangency-labs/smlib/pull/113)); the smooth-vertex End (#81), N ≥ 4 rounds and open setbacks (#86) and mixed convexity (#82) landing; the rest moved to solidcore | part merged |
| 4 | corners: Turn (Mitre, Swept), Join, Ball, End ([#79](https://github.com/tangency-labs/smlib/pull/79)); Setback with its certified convex fill ([#104](https://github.com/tangency-labs/smlib/pull/104)); the Ball on cylinders, cones and spheres ([#110](https://github.com/tangency-labs/smlib/pull/110)); the unreachable old corner code deleted ([#113](https://github.com/tangency-labs/smlib/pull/113)); the smooth-vertex End (#81) and mixed convexity (#82) merged; N ≥ 4 rounds and open setbacks (#86) landing; the rest moved to solidcore | part merged |
| 5 | fold and room checks, exact; refusals sized through `smlib_blend_fit_size` | merged in #79; remaining classes open |
| 6 | overflow trimmed at the crease, in place | merged in #79 |
| 7 | the round stored as its definition, with a certified net; the Ball's sphere patch kept through the C API's flat arrays ([#102](https://github.com/tangency-labs/smlib/issues/102)) | merged in #79 and #102; nesting, the fading end and USD's definition record open |
Expand All @@ -398,7 +398,7 @@ solidcore issue named.

| issue | topic | where |
|---|---|---|
| [#81](https://github.com/tangency-labs/smlib/issues/81) | a round ending at the smooth vertex of a partly selected tangent chain | landing in SMLib |
| [#81](https://github.com/tangency-labs/smlib/issues/81) | a round ending at the smooth vertex of a partly selected tangent chain | merged |
| [#82](https://github.com/tangency-labs/smlib/issues/82) | mixed convexity: convex and concave blends at one vertex (the test peg) | merged |
| [#83](https://github.com/tangency-labs/smlib/issues/83) | delete the old corner hierarchy | phase 1 merged (#113); the setback paths go with #86 |
| [#84](https://github.com/tangency-labs/smlib/issues/84) | several concave rounds at one vertex, unequal or N ≥ 4 | solidcore #2361 |
Expand Down
28 changes: 27 additions & 1 deletion source/SMLib/inc/SmBlendCorner.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ enum SmBlendEnd
{
SM_BEND_ON_END_FACE, // on the end face(s) between its side edges (an end rib), capped at a mixed convexity
SM_BEND_OPEN, // at a lamina edge (a sheet): its end section
SM_BEND_RUNS_OUT // its side faces continue each other through the vertex: its rails meet there
SM_BEND_RUNS_OUT, // its side faces continue each other through the vertex: its rails meet there
SM_BEND_AT_SMOOTH // its edge runs on tangentially into an edge not blended: cut square to the edge there
};

enum SmBlendTurn
Expand Down Expand Up @@ -81,6 +82,7 @@ class SM_EXPORT SmBlendCorner : public SmFilletCorner
SmBlendCornerEvent m_eEvent; // the corner's event (Classify)
SmBlendTurn m_eTurn; // a Turn's mode
SmBlendEnd m_eEnd; // an End's kind
SmSurface * m_pEndCap; // an End at a smooth vertex: the plane square to its edge there
SmBoolean m_bG1Case; // the two blended edges meet G1 (MakeTwoBlendTopology)
SmBoolean m_bMitre; // the two blends are mitred at the common face's concave corner
SmEdgeuse * m_pSideEU; // Swept: the side edge E's edgeuse the rails of the first round meet
Expand Down Expand Up @@ -156,6 +158,15 @@ class SM_EXPORT SmBlendCorner : public SmFilletCorner
SmStatus MakeEndOnEndFace();
SmStatus MakeEndOpen();
SmStatus MakeEndRunningOut();
SmStatus MakeEndAtSmoothVertex();
SmStatus CalcEndCapEdges();
SmStatus RefuseEndPastSideEdge(SmEdgeuse * pFilEdgeuse, SmEdgeuse * pSideEU, SmFace * pOtherFace);
SmStatus RadiusReachingSideEdgeEnd(SmEdgeuse * pFilEdgeuse, SmEdgeuse * pSideEU, SmFace * pOtherFace,
SmBoolean & rbPast, double & rdFit);
SmStatus BallTouchingAt(SmEdgeuse * pFilEdgeuse, SmEdgeuse * pSideEU, SmFace * pOtherFace, const SmPoint3d & crP,
SmBoolean & rbOnG, SmBoolean & rbWithin, double & rdRho);
SmStatus RefuseEndOverflowingSideEdge(SmEdgeuse * pFilEdgeuse, const SmTArray<SmEdgeuse*> & crSideEUs, SmFace * pOtherFace);
SmStatus SideEdgeChainTo(SmEdgeuse * pLast, SmTArray<SmEdgeuse*> & rChain);
SmStatus CalcEndEdgeGeom();
SmStatus CreateEndPatchOfEnd();

Expand Down Expand Up @@ -255,6 +266,15 @@ class SM_EXPORT SmBlendCorner : public SmFilletCorner
void SetEnd( SmBlendEnd eEnd ) { m_eEnd = eEnd; }
// whether a round ending at cpCornerVert runs out there: its side faces continue each other
static SmBoolean EndRunsOut( const SmVertex * pCornerVert, SmEdgeuse * pFilEdgeuse );
// whether the blended edge runs on at cpCornerVert, tangentially, into an edge of its convexity
// that is not blended (crAllEUs: the edgeuses round the vertex)
static SmBoolean EndAtSmoothVertex( const SmVertex * cpCornerVert, SmEdgeuse * pFilEdgeuse,
const SmTArray<SmEdgeuse*> & crAllEUs, double dTanTolDeg );
virtual SmSurface * GetEndCapSurface() const { return m_pEndCap; }
// an End on its end face, before it is built: the least radius at which a rail reaches its
// side edge's far end, where the rail runs past it (the refusal's reason: DescribeEndPastSideEdge)
SmStatus FitOfEndPastSideEdges( SmBoolean & rbFound, double & rdFit, SmEdge *& rpEdge );
static SmStatus DescribeEndPastSideEdge( double dFit, TCHAR * cWhy );

virtual double GetSetBackDistAlong(const SmEdge * pEdge);
void SetFillOrder(ULONG lOrder) { m_lFillOrder = lOrder; }
Expand All @@ -281,6 +301,12 @@ class SM_EXPORT SmBlendCorner : public SmFilletCorner
// pFilEdgeuse's edge (the one the solver's rail/side-edge solve takes). NULL when neither.
SmEdgeuse * sm_FindSideEdgeuse(SmEdgeuse * pFilEdgeuse, SmEdgeuse * pSideEU, int iDebugLevel);

// A side edge continued across its end pAt: the edge N that continues pEU's edge E G1 at pAt between
// the same two faces, where pAt's only other edge is a seam of one of them (a cylinder's seam ending
// on its rim splits the rim there and nothing else): N's edgeuse on pEU's faceuse. NULL otherwise,
// and for a closed E, or a pAt not E's end.
SmEdgeuse * sm_SideEdgeuseAcrossSeamVertex(SmEdgeuse * pEU, const SmVertex * pAt, double dAngTolDeg);

// Whether two edges at a vertex are tangent there (end tangents within dAngTolDeg); the angle
// between them (degrees, folded to [0, 90]) in *pdAngDeg when not NULL.
SmBoolean sm_TestG1Continuity(const SmVertex * pVert, const SmEdge * pEdge1, const SmEdge * pEdge2,
Expand Down
2 changes: 2 additions & 0 deletions source/SMLib/inc/SmFilletCorner.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ class SM_EXPORT SmFilletCorner : public SmObject
virtual SmBoolean IsClosedJoin() const { return FALSE; }
// SolidCraft change: an End on its end face(s) (SmBlendCorner)
virtual SmBoolean IsEndOnEndFace() const { return FALSE; }
// SolidCraft change: the surface an End at a smooth vertex is cut by (SmBlendCorner), or NULL
virtual SmSurface * GetEndCapSurface() const { return NULL; }

// utilities
void RecordFilletError(SmFilletErrorType eErrorType,
Expand Down
2 changes: 1 addition & 1 deletion source/SMLib/inc/SmFilletGeom.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class SM_EXPORT SmFilletVertex : public SmVertex
virtual SmStatus CalcCornerVertGeom ();
SmStatus CalcFilletIntFillet ();
SmStatus CalcFilletInt2Fillets ();
SmStatus CalcRailIntEdgeuse (SmFilletGeom * pOptFG = NULL);
SmStatus CalcRailIntEdgeuse (SmFilletGeom * pOptFG = NULL, const SmVertex * cpNear = NULL);
SmStatus CalcRailIntExtendedEdgeuse();
SmStatus CalcRailIntEndSurface (); // SmBlendCornerEnd.cpp: an End's rail end on the end face's surface
SmStatus CalcJoinSection (); // SmBlendCornerJoin.cpp: a Join's shared section, both its ends
Expand Down
80 changes: 79 additions & 1 deletion source/SMLib/src/SmBlendCorner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,77 @@ SmEdgeuse * sm_FindSideEdgeuse // rtn: edgeuse

} // end sm_FindSideEdgeuse

/*******************************************************************//**
PURPOSE: A side edge continued across its end pAt, where it is split only
by a seam: the next edge's edgeuse on pEU's faceuse, or NULL.

NOTES: The rail on a side face F ends on the side edge E, between F and
the end face; E ends at pAt. When pAt's only other edges are N, which
continues E G1 at pAt between the same two faces, and a seam of F or
of the end face (both its sides on that one face: a periodic
surface's seam ending on E), pAt is no corner of the body: it splits
one boundary of the two faces only because the seam ends there, and
the rail that runs past it ends on N. A third edge that is no seam
(a real edge between two faces) is a corner, and E is not continued.
***********************************************************************/
SmEdgeuse * sm_SideEdgeuseAcrossSeamVertex
(SmEdgeuse * pEU, // in : the side edgeuse, on the rail's face
const SmVertex * pAt, // in : the side edge's end to continue it across
double dAngTolDeg) // in : tangency tolerance (degrees)
{
if ( pEU == NULL || pAt == NULL || pEU->GetRadial() == NULL )
{ return NULL; }
SmEdge * pE = pEU->GetEdge();
if ( pE == NULL || pE->IsClosed()
|| ( pE->GetStartVertex() != pAt && pE->GetEndVertex() != pAt ))
{ return NULL; }
SmFace * pF = pEU->GetFace();
SmFace * pG = pEU->GetRadial()->GetFace();
if ( pF == NULL || pG == NULL || pF == pG )
{ return NULL; }

SmTArray<SmEdge*> sEdges;
pAt->GetEdges( sEdges );
if ( sEdges.GetSize() != 3 )
{ return NULL; }
SmEdge * pN = NULL;
SmEdge * pSeam = NULL;
for (ULONG ii=0; ii<3; ii++)
{
SmEdge * pX = sEdges[ii];
if ( pX == pE )
{ continue; }
SmTArray<SmFace*> sFaces;
pX->GetFaces( sFaces );
SmBoolean bOneFace = ( sFaces.GetSize() > 0 && ( sFaces[0] == pF || sFaces[0] == pG ) ) ? TRUE : FALSE;
for (ULONG kk=1; kk<sFaces.GetSize(); kk++)
{ bOneFace = ( bOneFace && sFaces[kk] == sFaces[0] ) ? TRUE : FALSE; }
if ( bOneFace && pX->IsSeam() )
{ pSeam = pX; }
else
{ pN = pX; }
}
if ( pN == NULL || pSeam == NULL || pN->IsClosed() )
{ return NULL; }

SmTArray<SmEdgeuse*> sEUs;
if ( pN->GetEdgeuses( sEUs ) != SM_SUCCESS )
{ return NULL; }
SmEdgeuse * pNext = NULL;
for (ULONG ii=0; ii<sEUs.GetSize() && pNext == NULL; ii++)
{
SmEdgeuse * pX = sEUs[ii];
if ( pX->GetFaceuse() == pEU->GetFaceuse()
&& pX->GetRadial() != NULL
&& pX->GetRadial()->GetFace() == pG )
{ pNext = pX; }
}
if ( pNext == NULL || ! sm_TestG1Continuity( pAt, pE, pN, dAngTolDeg, NULL, 0 ))
{ return NULL; }
return pNext;

} // end sm_SideEdgeuseAcrossSeamVertex

/********************************************************************
PURPOSE: Determine if two adjacent edges are tangent to each other
at a given vertex
Expand Down Expand Up @@ -323,6 +394,7 @@ SmBlendCorner::SmBlendCorner
m_eEvent(eEvent),
m_eTurn(eTurn),
m_eEnd(SM_BEND_ON_END_FACE),
m_pEndCap(NULL),
m_bG1Case(FALSE),
m_bMitre(FALSE),
m_pSideEU(NULL),
Expand All @@ -338,6 +410,7 @@ SmBlendCorner::SmBlendCorner

SmBlendCorner::~SmBlendCorner()
{
delete m_pEndCap;
DeleteSweptSurface();
DeleteBallSurface();
delete m_pFill;
Expand Down Expand Up @@ -1442,7 +1515,12 @@ SmStatus SmBlendCorner::MakeCornerTopology()
if ( m_eEvent == SM_BCE_JOIN )
{ return MakeJoinTopology(); }
if ( m_eEvent == SM_BCE_END )
{ return ( m_eEnd == SM_BEND_OPEN ) ? MakeEndOpen() : ( m_eEnd == SM_BEND_RUNS_OUT ) ? MakeEndRunningOut() : MakeEndOnEndFace(); }
{
return ( m_eEnd == SM_BEND_OPEN ) ? MakeEndOpen()
: ( m_eEnd == SM_BEND_RUNS_OUT ) ? MakeEndRunningOut()
: ( m_eEnd == SM_BEND_AT_SMOOTH ) ? MakeEndAtSmoothVertex()
: MakeEndOnEndFace();
}
if ( IsSetBack() )
{ return MakeSetBackTopology(); }
return IsSwept() ? MakeSweptTopology() : IsMitreTurn() ? MakeMitreTopology() : MakeTwoBlendTopology();
Expand Down
Loading
Loading