56网站可以做电子相册,深圳设计公司,网站怎么做二级页面,青岛外贸网站建站目录
1、球面的Brep数据
2、C遍历球面的边 这里以球面为例来说明如何遍历曲面的边。
1、球面的Brep数据
使用Tcl命令在Draw Test Harness中生成的球面并到出Brep数据如下#xff1a;
pload ALL
psphere asphere 1
dump asphere
结果如下#xff1a;
*********** D…目录
1、球面的Brep数据
2、C遍历球面的边 这里以球面为例来说明如何遍历曲面的边。
1、球面的Brep数据
使用Tcl命令在Draw Test Harness中生成的球面并到出Brep数据如下
pload ALL
psphere asphere 1
dump asphere
结果如下
*********** Dump of asphere *************
Shape : 9, FORWARD Dump of 9 TShapes ----------------- Flags : Free, Modified, Checked, Orientable, Closed, Infinite, Convex, Locked TShape # 1 : SOLID 11000000 0000018AE4364B70 2 TShape # 2 : SHELL 01011000 0000018AE43648F0 3 TShape # 3 : FACE 01110000 0000018AE420C530 4 Tolerance : 1e-07 - Surface : 1 TShape # 4 : WIRE 01011000 0000018AE4364270 -8 6 5 -6 TShape # 5 : EDGE 01010000 0000018AE3048880 7 -7 Tolerance : 1e-07 same parametrisation of curves same range on curves degenerated - PCurve : 4 on surface 1, range : 0 6.28318530717959 UV Points : 0, -1.5707963267949 6.28318530717959, -1.5707963267949 TShape # 6 : EDGE 01010000 0000018AE3049CC0 -9 7 Tolerance : 1e-07 same parametrisation of curves same range on curves - Curve 3D : 1, range : 4.71238898038469 7.85398163397448 - PCurve : 2, 3 (CN) on surface 1, range : 4.71238898038469 7.85398163397448 UV Points : 6.28318530717959, -1.5707963267949 6.28318530717959, 1.5707963267949 UV Points : 0, -1.5707963267949 0, 1.5707963267949 TShape # 7 : VERTEX 01011010 0000018AE420C6D0 Tolerance : 1e-07 - Point 3D : 6.12323399573677e-17, -1.49975978266186e-32, -1 TShape # 8 : EDGE 01010000 0000018AE3049C00 9 -9 Tolerance : 1e-07 same parametrisation of curves same range on curves degenerated - PCurve : 1 on surface 1, range : 0 6.28318530717959 UV Points : 0, 1.5707963267949 6.28318530717959, 1.5707963267949 TShape # 9 : VERTEX 01011010 0000018AE420C600 Tolerance : 1e-07 - Point 3D : 6.12323399573677e-17, -1.49975978266186e-32, 1 -------
Dump of 4 Curve2ds ------- 1 : Line Origin :0, 1.5707963267949 Axis :1, 0 2 : Line Origin :6.28318530717959, -6.28318530717959 Axis :0, 1 3 : Line Origin :0, -6.28318530717959 Axis :0, 1 4 : Line Origin :0, -1.5707963267949 Axis :1, 0 -------
Dump of 1 Curves ------- 1 : Circle Center :0, 0, 0 Axis :-2.44929359829471e-16, -1, 0 XAxis :1, -2.44929359829471e-16, 0 YAxis :0, 0, 1 Radius :1 -------
Dump of 0 Polygon3Ds ------- -------
Dump of 0 PolygonOnTriangulations ------- -------
Dump of 1 surfaces ------- 1 : SphericalSurface Center :0, 0, 0 Axis :0, 0, 1 XAxis :1, 0, -0 YAxis :-0, 1, 0 Radius :1 -------
Dump of 0 Triangulations ------- ------- Dump of 0 Locations -------
可见球面的数据中有3条边
2、C遍历球面的边
下面通过C来读取所有边的参数范围并判断边是否退化为点。
// OpenCascade library.
#define WNT
#include TopoDS.hxx
#include TopExp.hxx
#include TopExp_Explorer.hxx
#include BRepPrimAPI_MakeSphere.hxx
#include TopTools_ListIteratorOfListOfShape.hxx
#include TopTools_IndexedDataMapOfShapeListOfShape.hxx
#pragma comment(lib, TKernel.lib)
#pragma comment(lib, TKMath.lib)
#pragma comment(lib, TKBRep.lib)
#pragma comment(lib, TKTopAlgo.lib)
#pragma comment(lib, TKPrim.lib)
/**
* breif Find the face for the given edge, i.e the face which the given edge is on it.
*/
TopoDS_Face FindFaceOfEdge(const TopoDS_Shape theShape, const TopoDS_Edge theEdge)
{TopoDS_Face theFace;
TopTools_IndexedDataMapOfShapeListOfShape theMap;TopExp::MapShapesAndAncestors(theShape, TopAbs_EDGE, TopAbs_FACE, theMap);
const TopTools_ListOfShape theFaces theMap.FindFromKey(theEdge);TopTools_ListIteratorOfListOfShape theIterator(theFaces);
for (theIterator.Initialize(theFaces); theIterator.More(); theIterator.Next()){theFace TopoDS::Face(theIterator.Value());}
return theFace;
}
void TestSingularity(void)
{TopoDS_Shape theSphere BRepPrimAPI_MakeSphere(1.0);
for (TopExp_Explorer edgeExp(theSphere, TopAbs_EDGE); edgeExp.More(); edgeExp.Next()){const TopoDS_Edge anEdge TopoDS::Edge(edgeExp.Current());
Standard_Real aFirst 0.0;Standard_Real aLast 0.0;
gp_Pnt2d U1V1;gp_Pnt2d U2V2;
Standard_Boolean IsDegenerated BRep_Tool::Degenerated(anEdge);
BRep_Tool::Range(anEdge, aFirst, aLast);BRep_Tool::UVPoints(anEdge, FindFaceOfEdge(theSphere, anEdge), U1V1, U2V2);
std::cout Edge is Degenerated: (IsDegenerated ? True : False) std::endl;std::cout Edge parameters on face: std::endl;std::cout ( U1V1.X() , U1V1.Y() ) std::endl;std::cout ( U2V2.X() , U2V2.Y() ) std::endl;std::cout std::endl;}
}
int main(int argc, char* argv[])
{TestSingularity();
return 0;
}
Edge is Degenerated: True
Edge parameters on face: (0, 1.5708) (6.28319, 1.5708) Edge is Degenerated: False
Edge parameters on face: (6.28319, -1.5708) (6.28319, 1.5708) Edge is Degenerated: True
Edge parameters on face: (0, -1.5708) (6.28319, -1.5708) Edge is Degenerated: False
Edge parameters on face: (0, -1.5708) (0, 1.5708)