1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00
occt/src/BRepOffset/BRepOffset.hxx
abv 8574e3291f 0028968: Incorrect offset for the faces with singularities
Simple offset algorithm (BRepOffset_MakeSimpleOffset) is improved to handle the case when bspline surface has imprecise singularity at one of sides (when side is degenerated but not exactly to one point).
In such case, the algorithm tries to collapse all poles of singular side of the surface to the same point; this allows avoiding flapping of normal due to small fluctuations of surface.

If face being offset contains degenerated edges, then check for singularity is done using position and tolerance of corresponding vertices.
In addition, each side is checked with some user-defined tolerance (by default Precision::Confusion()); this helps to process cases when no edge is located at that side or if such edge is not encoded as degenerated.
New parameter Tolerance is introduced for that in BRepOffset_MakeSimpleOffset class.

Tests added:
bugs modelg_7 bug28968 - on isolated faces as reported in the issue, mostly for visual check (absence of loops)
offset simple F01-05 - on original shells, checking tolerances of resulting shell
2017-08-30 13:52:56 +03:00

69 lines
2.9 KiB
C++

// Created on: 1995-10-12
// Created by: Bruno DUMORTIER
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BRepOffset_HeaderFile
#define _BRepOffset_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BRepOffset_Status.hxx>
class Geom_Surface;
class TopoDS_Face;
//! Auxiliary tools for offset algorithms
class BRepOffset
{
public:
//! returns the Offset surface computed from the
//! surface <Surface> at an OffsetDistance <Offset>.
//!
//! If possible, this method returns the real type of
//! the surface ( e.g. An Offset of a plane is a plane).
//!
//! If no particular case is detected, the returned
//! surface will have the Type Geom_OffsetSurface.
//! Parameter allowC0 is then passed as last argument to
//! constructor of Geom_OffsetSurface.
Standard_EXPORT static Handle(Geom_Surface) Surface (const Handle(Geom_Surface)& Surface,
const Standard_Real Offset,
BRepOffset_Status& theStatus,
Standard_Boolean allowC0 = Standard_False);
//! Preprocess surface to be offset (bspline, bezier, or revolution based on
//! bspline or bezier curve), by collapsing each singular side to single point.
//!
//! This is to avoid possible flipping of normal at the singularity
//! of the surface due to non-zero distance between the poles that
//! logically should be in one point (singularity).
//!
//! The (parametric) side of the surface is considered to be singularity if face
//! has degenerated edge whose vertex encompasses (by its tolerance) all points on that side,
//! or if all poles defining that side fit into sphere with radius thePrecision.
//!
//! Returns either original surface or its modified copy (if some poles have been moved).
Standard_EXPORT static Handle(Geom_Surface) CollapseSingularities (const Handle(Geom_Surface)& theSurface,
const TopoDS_Face& theFace,
Standard_Real thePrecision);
};
#endif // _BRepOffset_HeaderFile