status_t curv_fun(real t, real *uv, real *dt, real *dtt, void *user_data);
status_t surf_fun(real *uv, real *xyz, real*du, real *dv,
- real *duu, real *duv, real *dvv, void *user_data);
+ real *duu, real *duv, real *dvv, void *user_data);
status_t message_callback(message_t *msg, void *user_data);
//=============================================================================
TopoDS_Edge e = TopoDS::Edge(edge_iter.Current());
int ic = emap.FindIndex(e);
if (ic <= 0)
- ic = emap.Add(e);
+ ic = emap.Add(e);
double tmin,tmax;
curves.push_back(BRep_Tool::CurveOnSurface(e, f, tmin, tmax));
gp_Pnt ee0 = surfaces.back()->Value(e0.X(), e0.Y());
Standard_Real d1=0,d2=0;
for (TopExp_Explorer ex_edge(e ,TopAbs_VERTEX); ex_edge.More(); ex_edge.Next()) {
- TopoDS_Vertex v = TopoDS::Vertex(ex_edge.Current());
-
- ++npts;
- if (npts == 1){
- ip = &ip1;
- d1 = ee0.SquareDistance(BRep_Tool::Pnt(v));
- } else {
- ip = &ip2;
+ TopoDS_Vertex v = TopoDS::Vertex(ex_edge.Current());
+
+ ++npts;
+ if (npts == 1){
+ ip = &ip1;
+ d1 = ee0.SquareDistance(BRep_Tool::Pnt(v));
+ } else {
+ ip = &ip2;
d2 = ee0.SquareDistance(BRep_Tool::Pnt(v));
- }
- *ip = pmap.FindIndex(v);
- if(*ip <= 0)
- *ip = pmap.Add(v);
+ }
+ *ip = pmap.FindIndex(v);
+ if(*ip <= 0)
+ *ip = pmap.Add(v);
}
if (npts != 2) {
- // should not happen
- cout << "An edge does not have 2 extremities." << endl;
+ // should not happen
+ cout << "An edge does not have 2 extremities." << endl;
} else {
- if (d1 < d2)
- cad_edge_set_extremities(edg, ip1, ip2);
- else
- cad_edge_set_extremities(edg, ip2, ip1);
+ if (d1 < d2)
+ cad_edge_set_extremities(edg, ip1, ip2);
+ else
+ cad_edge_set_extremities(edg, ip2, ip1);
}
} // for edge
} //for face
mesh_get_edge_tag(msh, it, &tag);
if (tags[vtx[0]]) {
- meshDS->SetNodeOnEdge(nodes[vtx[0]], TopoDS::Edge(emap(tag)));
+ Set_NodeOnEdge(meshDS, nodes[vtx[0]], emap(tag));
tags[vtx[0]] = false;
};
if (tags[vtx[1]]) {
- meshDS->SetNodeOnEdge(nodes[vtx[1]], TopoDS::Edge(emap(tag)));
+ Set_NodeOnEdge(meshDS, nodes[vtx[1]], emap(tag));
tags[vtx[1]] = false;
};
meshDS->SetMeshElementOnShape(edg, TopoDS::Edge(emap(tag)));
return true;
}
+//=============================================================================
+/*!
+ * SetNodeOnEdge
+ */
+//=============================================================================
+
+void BLSURFPlugin_BLSURF::Set_NodeOnEdge(SMESHDS_Mesh* meshDS, SMDS_MeshNode* node, const TopoDS_Shape& ed) {
+ const TopoDS_Edge edge = TopoDS::Edge(ed);
+
+ gp_Pnt pnt(node->X(), node->Y(), node->Z());
+
+ Standard_Real p0 = 0.0;
+ Standard_Real p1 = 1.0;
+ TopLoc_Location loc;
+ Handle(Geom_Curve) curve = BRep_Tool::Curve(edge, loc, p0, p1);
+
+ if ( !loc.IsIdentity() ) pnt.Transform( loc.Transformation().Inverted() );
+ GeomAPI_ProjectPointOnCurve proj(pnt, curve, p0, p1);
+
+ double pa = 0.;
+ if ( proj.NbPoints() > 0 )
+ pa = (double)proj.LowerDistanceParameter();
+
+// GProp_GProps LProps;
+// BRepGProp::LinearProperties(ed, LProps);
+// double lg = (double)LProps.Mass();
+
+ meshDS->SetNodeOnEdge(node, edge, pa);
+}
+
//=============================================================================
/*!
*
}
status_t surf_fun(real *uv, real *xyz, real*du, real *dv,
- real *duu, real *duv, real *dvv, void *user_data)
+ real *duu, real *duv, real *dvv, void *user_data)
{
const Geom_Surface* geometry = (const Geom_Surface*) user_data;