Open CASCADE Technology Reference Manual 8.0.2
Loading...
Searching...
No Matches
BRepGraph_Transform Class Reference

Graph-to-graph transformation. More...

#include <BRepGraph_Transform.hxx>

Public Member Functions

 BRepGraph_Transform ()=delete

Static Public Member Functions

static bool Perform (const BRepGraph &theSourceGraph, BRepGraph &theTargetGraph, const gp_Trsf &theTrsf, const BRepGraph_Copy::GeomPolicy theGeomPolicy=BRepGraph_Copy::GeomPolicy::Copy, const BRepGraph_Copy::MeshPolicy theMeshPolicy=BRepGraph_Copy::MeshPolicy::Drop)
 Transform the entire graph into a target graph.
static BRepGraph_NodeId TransformNode (const BRepGraph &theSourceGraph, BRepGraph &theTargetGraph, const BRepGraph_NodeId theNodeId, const gp_Trsf &theTrsf, const BRepGraph_Copy::GeomPolicy theGeomPolicy=BRepGraph_Copy::GeomPolicy::Copy, const BRepGraph_Copy::MeshPolicy theMeshPolicy=BRepGraph_Copy::MeshPolicy::Drop)
 Transform a single node sub-graph of any kind. Topology nodes are copied and transformed by baking the transform into their definitions.
static bool MoveRef (BRepGraph &theGraph, const BRepGraph_ChildRefId theRefId, const gp_Trsf &theTrsf)
 Apply an in-place location-only transform to a child reference. Composes theTrsf into ChildRef placement without copying any geometry. Cached mesh data on entities downstream of the moved ref is stored in the entity's local frame and is unaffected; callers that bake a world transform into a cache key own the invalidation responsibility.
static bool MoveRef (BRepGraph &theGraph, const BRepGraph_OccurrenceRefId theRefId, const gp_Trsf &theTrsf)
 Apply an in-place location-only transform to an occurrence reference. Composes theTrsf into OccurrenceRef placement without copying any geometry.

Detailed Description

Graph-to-graph transformation.

Applies a geometric transformation to vertex points and geometry node locations by copying into a target graph, then transforming in-place.

Two geometry modes (matching BRepBuilderAPI_Transform semantics):

  • GeomPolicy::Copy (geometry-level): deep-copy geometry, create new transformed handles via Geom_Geometry::Transformed(), reset locations to identity.
  • GeomPolicy::Share (root-level): light-copy with shared geometry, apply transform via location modification only.

Mesh handling (MeshPolicy parameter):

  • MeshPolicy::Drop (default for Transform): triangulations and polygons are discarded after a geometry-level transform and must be recomputed.
  • MeshPolicy::Copy: all mesh data (Poly_Triangulation on FaceDefs and the MeshLayer cache, Poly_Polygon3D on edges, Poly_PolygonOnTriangulation on coedges) is copied and transformed in sync with the geometry. In location-only mode the mesh data is copied as-is (nodes stay in the graph coordinate system, which is unaffected by a pure location compose).
Note
Check the return value for success: Perform returns bool, TransformNode returns the mapped root NodeId (invalid on failure).

Typical usage

BRepGraph aGraph;
aGraph.Shapes().Add(myShape);
gp_Trsf aTrsf;
aTrsf.SetTranslation(gp_Vec(10.0, 0.0, 0.0));
BRepGraph aTransformed;
BRepGraph_Transform::Perform(aGraph, aTransformed, aTrsf);
TopoDS_Shape aShape = aTransformed.Shapes().Shape();
TopoDS_Shape Shape(const BRepGraph_NodeId theNode) const
Return or reconstruct a TopoDS_Shape for a node. Prefer this route for repeated public queries....
Result Add(const TopoDS_Shape &theShape)
Ingest a TopoDS_Shape as a new root subgraph, wrapping the topology root in a Product.
static bool Perform(const BRepGraph &theSourceGraph, BRepGraph &theTargetGraph, const gp_Trsf &theTrsf, const BRepGraph_Copy::GeomPolicy theGeomPolicy=BRepGraph_Copy::GeomPolicy::Copy, const BRepGraph_Copy::MeshPolicy theMeshPolicy=BRepGraph_Copy::MeshPolicy::Drop)
Transform the entire graph into a target graph.
Topology-geometry graph over TopoDS / BRep.
Definition BRepGraph.hxx:122
ShapesView & Shapes()
Access cached and fresh shape reconstruction.
Describes a shape which.
Definition TopoDS_Shape.hxx:41
Defines a non-persistent transformation in 3D space. The following transformations are implemented : ...
Definition gp_Trsf.hxx:59
constexpr void SetTranslation(const gp_Vec &theV) noexcept
Changes the transformation into a translation. theV is the vector of the translation.
Definition gp_Trsf.hxx:400
Defines a non-persistent vector in 3D space.
Definition gp_Vec.hxx:30

Constructor & Destructor Documentation

◆ BRepGraph_Transform()

BRepGraph_Transform::BRepGraph_Transform ( )
delete

Member Function Documentation

◆ MoveRef() [1/2]

bool BRepGraph_Transform::MoveRef ( BRepGraph & theGraph,
const BRepGraph_ChildRefId theRefId,
const gp_Trsf & theTrsf )
static

Apply an in-place location-only transform to a child reference. Composes theTrsf into ChildRef placement without copying any geometry. Cached mesh data on entities downstream of the moved ref is stored in the entity's local frame and is unaffected; callers that bake a world transform into a cache key own the invalidation responsibility.

Note
Only pure rotation/translation transforms (scale == 1) are supported. The method returns false if |scaleFactor| != 1.
Parameters
[in]theGraphthe graph containing the reference
[in]theRefIdchild reference to move
[in]theTrsfthe transformation to compose into the location
Returns
true on success; false if the ref is invalid/removed or theTrsf has non-unit scale

◆ MoveRef() [2/2]

bool BRepGraph_Transform::MoveRef ( BRepGraph & theGraph,
const BRepGraph_OccurrenceRefId theRefId,
const gp_Trsf & theTrsf )
static

Apply an in-place location-only transform to an occurrence reference. Composes theTrsf into OccurrenceRef placement without copying any geometry.

Note
Only pure rotation/translation transforms (scale == 1) are supported.
Returns
true on success; false if the ref is invalid/removed or theTrsf has non-unit scale

◆ Perform()

bool BRepGraph_Transform::Perform ( const BRepGraph & theSourceGraph,
BRepGraph & theTargetGraph,
const gp_Trsf & theTrsf,
const BRepGraph_Copy::GeomPolicy theGeomPolicy = BRepGraph_Copy::GeomPolicy::Copy,
const BRepGraph_Copy::MeshPolicy theMeshPolicy = BRepGraph_Copy::MeshPolicy::Drop )
static

Transform the entire graph into a target graph.

Self-transform (theSourceGraph == theTargetGraph): Applies transform in-place on theTargetGraph.

External transform to empty target (theTargetGraph.IsEmpty()): Copies source into target, then transforms.

External transform to non-empty target: Appends source entities into target with explicit mapping, then transforms.

Parameters
[in]theSourceGrapha pre-built BRepGraph (must not be empty)
[in,out]theTargetGraphdestination graph (may already contain data)
[in]theTrsfthe transformation to apply
[in]theGeomPolicygeometry handle policy (default: Copy)
[in]theMeshPolicymesh data policy (default: Drop)
Returns
true on success, false on failure (empty source, or Drop + geometry-modification-required)

◆ TransformNode()

BRepGraph_NodeId BRepGraph_Transform::TransformNode ( const BRepGraph & theSourceGraph,
BRepGraph & theTargetGraph,
const BRepGraph_NodeId theNodeId,
const gp_Trsf & theTrsf,
const BRepGraph_Copy::GeomPolicy theGeomPolicy = BRepGraph_Copy::GeomPolicy::Copy,
const BRepGraph_Copy::MeshPolicy theMeshPolicy = BRepGraph_Copy::MeshPolicy::Drop )
staticnodiscard

Transform a single node sub-graph of any kind. Topology nodes are copied and transformed by baking the transform into their definitions.

Self-transform (theSourceGraph == theTargetGraph): Duplicates the sub-graph with new entity IDs, then transforms the copy.

External transform: Copies the sub-graph into theTargetGraph, then transforms.

Parameters
[in]theSourceGrapha pre-built BRepGraph
[in,out]theTargetGraphdestination graph (may already contain data)
[in]theNodeIdnode identifier (any kind)
[in]theTrsfthe transformation to apply
[in]theGeomPolicygeometry handle policy (default: Copy; Drop is invalid for topology)
[in]theMeshPolicymesh data policy (default: Drop)
Returns
the mapped root NodeId in theTargetGraph, or invalid NodeId on failure

The documentation for this class was generated from the following file: