如何在百度建立自己的网站,2018做网站前景好么,养车网站开发,wdcp装wordpressopencascade TopoDS_Shape
前言
描述了一个形状#xff0c;它 引用了一个基础形状#xff0c;该基础形状有可能被赋予一个位置和方向 为基础形状提供了一个位置#xff0c;定义了它在本地坐标系中的位置为基础形状提供了一个方向#xff0c;这是从几何学的角度#xff…opencascade TopoDS_Shape
前言
描述了一个形状它 引用了一个基础形状该基础形状有可能被赋予一个位置和方向 为基础形状提供了一个位置定义了它在本地坐标系中的位置为基础形状提供了一个方向这是从几何学的角度而不是相对于其他形状的方向来定义的。注意如果一个形状引用的基础形状的形状列表为空则该形状被视为空。
1
创建一个不引用任何内容的空形状 TopoDS_Shape() : myOrient(TopAbs_EXTERNAL)
2
通用移动构造函数也接受子类TopoDS_Shape层次结构仅声明了没有额外字段的假子类。 template TopoDS_Shape(T2 theOther, typename std::enable_ifopencascade::std::is_base_ofTopoDS_Shape, T2::value::type* 0) : myTShape(std::forward(theOther).myTShape), myLocation(std::forward(theOther).myLocation), myOrient(std::forward(theOther).myOrient)
3
通用移动赋值运算符。 template typename std::enable_ifopencascade::std::is_base_ofTopoDS_Shape, T2::value, TopoDS_Shape::type operator(T2 theOther)
4
如果此形状为空则返回true。换句话说它不引用任何可能被赋予位置和方向的基础形状。 IsNull()
5
销毁存储在此形状中的对基础形状的引用。结果此形状变为空。 void Nullify()
6
返回形状的局部坐标系。 const TopLoc_Location Location() const { return myLocation; }
7
设置形状的局部坐标系。 void Location(const TopLoc_Location theLoc, const Standard_Boolean theRaiseExc Standard_True)
8
返回一个与相似但局部坐标系设置为的形状。 TopoDS_Shape Located(const TopLoc_Location theLoc, const Standard_Boolean theRaiseExc Standard_True)
9
返回形状的方向。 TopAbs_Orientation Orientation() const { return myOrient; }
10
设置形状的方向。 void Orientation(TopAbs_Orientation theOrient) { myOrient theOrient; }
11
返回一个与相似但方向设置为的形状。 TopoDS_Shape Oriented(TopAbs_Orientation theOrient) const { TopoDS_Shape aShape(*this); aShape.Orientation(theOrient); return aShape; } #### 12 返回一个指向实际形状实现的句柄。 const Handle(TopoDS_TShape) TShape() const { return myTShape; } #### 13 返回与此形状对应的TopAbs_ShapeEnum枚举值 例如VERTEX、EDGE等。 异常 如果此形状为空则抛出Standard_NullObject异常。 TopAbs_ShapeEnum ShapeType() const { return myTShape-ShapeType(); } #### 14 返回自由标志的值。 Standard_Boolean Free() const { return myTShape-Free(); } #### 15 设置自由标志。 void Free(Standard_Boolean theIsFree) { myTShape-Free(theIsFree); } #### 16 返回锁定标志的值。 Standard_Boolean Locked() const { return myTShape-Locked(); } #### 17 设置锁定标志。 void Locked(Standard_Boolean theIsLocked) { myTShape-Locked(theIsLocked); } #### 18 返回修改标志的值。 Standard_Boolean Modified() const { return myTShape-Modified(); } #### 19 设置修改标志。 void Modified(Standard_Boolean theIsModified) { myTShape-Modified(theIsModified); } ####20 返回检查标志的值。 Standard_Boolean Checked() const { return myTShape-Checked(); } #### 21 设置检查标志。 void Checked(Standard_Boolean theIsChecked) { myTShape-Checked(theIsChecked); }
22
返回可定向性标志的值。 Standard_Boolean Orientable() const { return myTShape-Orientable(); }
23
设置可定向性标志。 void Orientable(const Standard_Boolean theIsOrientable) { myTShape-Orientable(theIsOrientable); }
24
返回封闭性标志的值。 Standard_Boolean Closed() const { return myTShape-Closed(); }
25
设置封闭性标志。 void Closed(Standard_Boolean theIsClosed) { myTShape-Closed(theIsClosed); }
26
返回无穷性标志的值。 Standard_Boolean Infinite() const { return myTShape-Infinite(); }
27
设置无穷性标志。 void Infinite(Standard_Boolean theIsInfinite) { myTShape-Infinite(theIsInfinite); }
28
返回凸性标志的值。 Standard_Boolean Convex() const { return myTShape-Convex(); }
29
设置凸性标志。 void Convex(Standard_Boolean theIsConvex) { myTShape-Convex(theIsConvex); }
30
将形状的位置乘以thePosition。 void Move(const TopLoc_Location thePosition, const Standard_Boolean theRaiseExc Standard_True)
31
返回一个与相似但位置乘以thePosition的形状。 TopoDS_Shape Moved(const TopLoc_Location thePosition, const Standard_Boolean theRaiseExc Standard_True)
32
使用TopAbs包中的Reverse方法反转方向。 void Reverse() { myOrient TopAbs::Reverse(myOrient); }
33
返回一个与相似但方向使用TopAbs包中的Reverse方法反转的形状。 TopoDS_Shape Reversed() const
34
使用TopAbs包中的Complement方法补全方向。 void Complement() { myOrient TopAbs::Complement(myOrient); }
35
返回一个与相似但方向使用TopAbs包中的Complement方法补全的形状。 TopoDS_Shape Complemented() const
36
使用TopAbs包中的Compose方法更新形状的方向通过与theOrient组合。 void Compose(TopAbs_Orientation theOrient)
37
返回一个与相似但方向使用TopAbs包中的Compose方法与theOrient组合的形状。 TopoDS_Shape Composed(TopAbs_Orientation theOrient) const
38
返回直接子形状子节点的数量。 TopoDS_Iterator 用于访问子形状 Standard_Integer NbChildren() const { return myTShape.IsNull() ? 0 : myTShape-NbChildren(); }
39
//! 如果两个形状是伙伴则返回True即如果它们共享同一个TShape。 //! 位置和方向可能不同。 Standard_Boolean IsPartner(const TopoDS_Shape theOther) const { return (myTShape theOther.myTShape); }
40
//! 如果两个形状相同则返回True即如果它们共享同一个TShape和相同的位置。 //! 方向可能不同。 Standard_Boolean IsSame(const TopoDS_Shape theOther) const { return myTShape theOther.myTShape myLocation theOther.myLocation; }
45
//! 如果两个形状相等则返回True即如果它们共享同一个TShape、相同的位置和方向。 Standard_Boolean IsEqual(const TopoDS_Shape theOther) const { return myTShape theOther.myTShape myLocation theOther.myLocation myOrient theOther.myOrient; }
46
//! 返回一个表示的哈希值。该值在范围[1, theUpperBound]内。它是根据 //! TShape和Location计算得出的。Orientation方向未被使用。 //! param theUpperBound 计算哈希码时必须位于的范围的上界 //! return 一个计算出的哈希码范围在[1, theUpperBound]内 Standard_EXPORT Standard_Integer HashCode(Standard_Integer theUpperBound) const;
47
//! 用一个新的Shape替换该Shape具有相同的 //! Orientation方向和Location位置以及一个新的TShape该TShape具有 //! 相同的几何形状但没有子形状。 void EmptyCopy() { myTShape myTShape-EmptyCopy(); }
48
//! 返回一个新的Shape该Shape具有相同的 //! Orientation方向和Location位置以及一个新的TShape该TShape具有 //! 相同的几何形状但没有子形状。 TopoDS_Shape EmptyCopied() const { TopoDS_Shape aShape(*this); aShape.EmptyCopy(); return aShape; }
49
设置TShape void TShape(const Handle(TopoDS_TShape) theTShape) { myTShape theTShape; }
50
将我的内容转储到流中 Standard_EXPORT void DumpJson(Standard_OStream theOStream, Standard_Integer theDepth -1) const;
用法用例
TopoDS_Shape 是 OpenCASCADE 中表示拓扑形状的基类它本身是一个抽象类不能直接实例化。但是它定义了一些方法和操作可以通过其派生类如 TopoDS_Vertex、TopoDS_Edge、TopoDS_Face、TopoDS_Solid 等来操作和访问拓扑形状的属性和信息。
以下是一些示例展示了如何使用 TopoDS_Shape 类中的方法及其派生类的操作
1. 获取拓扑类型
通过 ShapeType() 方法可以获取拓扑形状的类型它返回一个枚举值表示形状的具体类型顶点、边、面、实体等。
#include TopoDS_Shape.hxx
#include TopoDS_Vertex.hxx
#include TopoDS_Edge.hxx
#include TopoDS_Face.hxx
#include TopoDS_Solid.hxx
#include TopExp.hxx
#include iostreamvoid PrintShapeType(const TopoDS_Shape shape) {switch (shape.ShapeType()) {case TopAbs_VERTEX:std::cout Shape is a vertex. std::endl;break;case TopAbs_EDGE:std::cout Shape is an edge. std::endl;break;case TopAbs_FACE:std::cout Shape is a face. std::endl;break;case TopAbs_SOLID:std::cout Shape is a solid. std::endl;break;default:std::cout Unknown shape type. std::endl;break;}
}int main() {// 示例创建一个顶点TopoDS_Vertex vertex;// 在实际应用中需要通过构造函数或者其他方法来创建顶点// 打印顶点的类型PrintShapeType(vertex);return 0;
}2. 拓扑结构查询
通过 TopExp 类提供的方法可以进行更复杂的拓扑结构查询如查找顶点、边、面之间的关系和连接。
#include TopoDS_Shape.hxx
#include TopoDS_Vertex.hxx
#include TopoDS_Edge.hxx
#include TopoDS_Face.hxx
#include TopExp.hxx
#include iostreamvoid PrintConnectedEdges(const TopoDS_Vertex vertex) {// 查找连接到顶点的边TopTools_IndexedMapOfShape edgeMap;TopExp::MapShapes(vertex, TopAbs_EDGE, edgeMap);for (int i 1; i edgeMap.Extent(); i) {const TopoDS_Edge edge TopoDS::Edge(edgeMap(i));std::cout Connected edge with orientation: (edge.Orientation() TopAbs_FORWARD ? Forward : Reversed) std::endl;}
}int main() {// 示例创建一个顶点和一条边TopoDS_Vertex vertex;// 在实际应用中需要通过构造函数或者其他方法来创建顶点TopoDS_Edge edge;// 在实际应用中需要通过构造函数或者其他方法来创建边// 打印顶点连接的边PrintConnectedEdges(vertex);return 0;
}3. 拓扑属性访问
通过 TopoDS_Shape 类及其派生类可以访问拓扑形状的特定属性如边的起点和终点、面的法向量等。
#include TopoDS_Shape.hxx
#include TopoDS_Edge.hxx
#include BRep_Tool.hxx
#include gp_Pnt.hxx
#include iostreamvoid PrintEdgeVertices(const TopoDS_Edge edge) {// 获取边的起点和终点坐标const TopoDS_Vertex startVertex TopExp::FirstVertex(edge);const TopoDS_Vertex endVertex TopExp::LastVertex(edge);gp_Pnt startPoint BRep_Tool::Pnt(startVertex);gp_Pnt endPoint BRep_Tool::Pnt(endVertex);std::cout Edge start point: ( startPoint.X() , startPoint.Y() , startPoint.Z() ) std::endl;std::cout Edge end point: ( endPoint.X() , endPoint.Y() , endPoint.Z() ) std::endl;
}int main() {// 示例创建一条边TopoDS_Edge edge;// 在实际应用中需要通过构造函数或者其他方法来创建边// 打印边的起点和终点坐标PrintEdgeVertices(edge);return 0;
}这些示例展示了如何利用 TopoDS_Shape 及其派生类的方法来操作和查询拓扑形状的信息。在实际应用中根据具体的需求和场景可以进一步组合和扩展这些方法以实现更复杂的几何建模和拓扑操作。 参考 文章转载自: http://www.morning.lwzpp.cn.gov.cn.lwzpp.cn http://www.morning.tbnn.cn.gov.cn.tbnn.cn http://www.morning.gwqcr.cn.gov.cn.gwqcr.cn http://www.morning.wrtw.cn.gov.cn.wrtw.cn http://www.morning.dbsch.cn.gov.cn.dbsch.cn http://www.morning.hfytgp.cn.gov.cn.hfytgp.cn http://www.morning.rnzwh.cn.gov.cn.rnzwh.cn http://www.morning.fhghy.cn.gov.cn.fhghy.cn http://www.morning.spwm.cn.gov.cn.spwm.cn http://www.morning.wqbzt.cn.gov.cn.wqbzt.cn http://www.morning.lqklf.cn.gov.cn.lqklf.cn http://www.morning.nftzn.cn.gov.cn.nftzn.cn http://www.morning.lhgkr.cn.gov.cn.lhgkr.cn http://www.morning.nhbhc.cn.gov.cn.nhbhc.cn http://www.morning.tkrpt.cn.gov.cn.tkrpt.cn http://www.morning.jqmqf.cn.gov.cn.jqmqf.cn http://www.morning.nsmyj.cn.gov.cn.nsmyj.cn http://www.morning.wjrq.cn.gov.cn.wjrq.cn http://www.morning.jxrpn.cn.gov.cn.jxrpn.cn http://www.morning.ckrnq.cn.gov.cn.ckrnq.cn http://www.morning.ljdjn.cn.gov.cn.ljdjn.cn http://www.morning.qfgwx.cn.gov.cn.qfgwx.cn http://www.morning.dxhnm.cn.gov.cn.dxhnm.cn http://www.morning.nqpy.cn.gov.cn.nqpy.cn http://www.morning.tfbpz.cn.gov.cn.tfbpz.cn http://www.morning.fxzgw.com.gov.cn.fxzgw.com http://www.morning.wschl.cn.gov.cn.wschl.cn http://www.morning.dljujia.com.gov.cn.dljujia.com http://www.morning.yhljc.cn.gov.cn.yhljc.cn http://www.morning.bmqls.cn.gov.cn.bmqls.cn http://www.morning.fgrcd.cn.gov.cn.fgrcd.cn http://www.morning.jwbfj.cn.gov.cn.jwbfj.cn http://www.morning.rnht.cn.gov.cn.rnht.cn http://www.morning.sffwz.cn.gov.cn.sffwz.cn http://www.morning.dzgyr.cn.gov.cn.dzgyr.cn http://www.morning.htbsk.cn.gov.cn.htbsk.cn http://www.morning.grfhd.cn.gov.cn.grfhd.cn http://www.morning.fnxzk.cn.gov.cn.fnxzk.cn http://www.morning.ndxss.cn.gov.cn.ndxss.cn http://www.morning.sthp.cn.gov.cn.sthp.cn http://www.morning.jbqwb.cn.gov.cn.jbqwb.cn http://www.morning.thbnt.cn.gov.cn.thbnt.cn http://www.morning.drcnn.cn.gov.cn.drcnn.cn http://www.morning.jfgmx.cn.gov.cn.jfgmx.cn http://www.morning.rksg.cn.gov.cn.rksg.cn http://www.morning.mmplj.cn.gov.cn.mmplj.cn http://www.morning.qrwdg.cn.gov.cn.qrwdg.cn http://www.morning.fnwny.cn.gov.cn.fnwny.cn http://www.morning.coffeedelsol.com.gov.cn.coffeedelsol.com http://www.morning.rmryl.cn.gov.cn.rmryl.cn http://www.morning.pudejun.com.gov.cn.pudejun.com http://www.morning.qpxrr.cn.gov.cn.qpxrr.cn http://www.morning.dnqliv.cn.gov.cn.dnqliv.cn http://www.morning.wjlnz.cn.gov.cn.wjlnz.cn http://www.morning.bqmdl.cn.gov.cn.bqmdl.cn http://www.morning.jmlgk.cn.gov.cn.jmlgk.cn http://www.morning.clpdm.cn.gov.cn.clpdm.cn http://www.morning.chzbq.cn.gov.cn.chzbq.cn http://www.morning.kfhm.cn.gov.cn.kfhm.cn http://www.morning.wfqcs.cn.gov.cn.wfqcs.cn http://www.morning.xwlhc.cn.gov.cn.xwlhc.cn http://www.morning.mbqyl.cn.gov.cn.mbqyl.cn http://www.morning.gqflj.cn.gov.cn.gqflj.cn http://www.morning.bkqw.cn.gov.cn.bkqw.cn http://www.morning.yckrm.cn.gov.cn.yckrm.cn http://www.morning.jtszm.cn.gov.cn.jtszm.cn http://www.morning.ckrnq.cn.gov.cn.ckrnq.cn http://www.morning.ljcf.cn.gov.cn.ljcf.cn http://www.morning.mfnjk.cn.gov.cn.mfnjk.cn http://www.morning.gtbjc.cn.gov.cn.gtbjc.cn http://www.morning.wknj.cn.gov.cn.wknj.cn http://www.morning.cjmmn.cn.gov.cn.cjmmn.cn http://www.morning.zffps.cn.gov.cn.zffps.cn http://www.morning.tqrjj.cn.gov.cn.tqrjj.cn http://www.morning.mrbmc.cn.gov.cn.mrbmc.cn http://www.morning.taojava.cn.gov.cn.taojava.cn http://www.morning.0small.cn.gov.cn.0small.cn http://www.morning.zzbwjy.cn.gov.cn.zzbwjy.cn http://www.morning.prgnp.cn.gov.cn.prgnp.cn http://www.morning.mymz.cn.gov.cn.mymz.cn