mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-24 01:22:05 +05:00
NPAL15298: KindOfShape. A fix by PKV for location of some shapes (DISK_ELLIPSE, some polygones).
This commit is contained in:
parent
8ebac247f3
commit
70295d0afc
@ -588,6 +588,11 @@ static
|
|||||||
else {
|
else {
|
||||||
aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
|
aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
|
||||||
aInfo.SetKindOfName(GEOMAlgo_KN_ARCCIRCLE);
|
aInfo.SetKindOfName(GEOMAlgo_KN_ARCCIRCLE);
|
||||||
|
//
|
||||||
|
gp_Vec aVecX(aP, aP1);
|
||||||
|
gp_Dir aDirX(aVecX);
|
||||||
|
gp_Ax2 aAx2new(aP, aAx2.Direction(), aDirX);
|
||||||
|
aInfo.SetPosition(aAx2new);
|
||||||
}
|
}
|
||||||
}// else if (aCT==GeomAbs_Circle) {
|
}// else if (aCT==GeomAbs_Circle) {
|
||||||
//
|
//
|
||||||
@ -625,6 +630,11 @@ static
|
|||||||
else {
|
else {
|
||||||
aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
|
aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
|
||||||
aInfo.SetKindOfName(GEOMAlgo_KN_ARCELLIPSE);
|
aInfo.SetKindOfName(GEOMAlgo_KN_ARCELLIPSE);
|
||||||
|
//
|
||||||
|
gp_Vec aVecX(aP, aP1);
|
||||||
|
gp_Dir aDirX(aVecX);
|
||||||
|
gp_Ax2 aAx2new(aP, aAx2.Direction(), aDirX);
|
||||||
|
aInfo.SetPosition(aAx2new);
|
||||||
}
|
}
|
||||||
}// else if (aCT==GeomAbs_Ellipse) {
|
}// else if (aCT==GeomAbs_Ellipse) {
|
||||||
//
|
//
|
||||||
|
@ -294,12 +294,16 @@
|
|||||||
aKN=GEOMAlgo_KN_DISKCIRCLE;
|
aKN=GEOMAlgo_KN_DISKCIRCLE;
|
||||||
aInfo.SetKindOfName(aKN);
|
aInfo.SetKindOfName(aKN);
|
||||||
aInfo.SetRadius1(aInfoE.Radius1());
|
aInfo.SetRadius1(aInfoE.Radius1());
|
||||||
|
aInfo.SetLocation(aInfoE.Location());
|
||||||
|
aInfo.SetPosition(aInfoE.Position());
|
||||||
}
|
}
|
||||||
if (aKNE==GEOMAlgo_KN_ELLIPSE) {
|
if (aKNE==GEOMAlgo_KN_ELLIPSE) {
|
||||||
aKN=GEOMAlgo_KN_DISKELLIPSE;
|
aKN=GEOMAlgo_KN_DISKELLIPSE;
|
||||||
aInfo.SetKindOfName(aKN);
|
aInfo.SetKindOfName(aKN);
|
||||||
aInfo.SetRadius1(aInfoE.Radius1());
|
aInfo.SetRadius1(aInfoE.Radius1());
|
||||||
aInfo.SetRadius2(aInfoE.Radius2());
|
aInfo.SetRadius2(aInfoE.Radius2());
|
||||||
|
aInfo.SetLocation(aInfoE.Location());
|
||||||
|
aInfo.SetPosition(aInfoE.Position());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -319,8 +323,33 @@
|
|||||||
//
|
//
|
||||||
if (aNbV==3 && aNbE==3) {
|
if (aNbV==3 && aNbE==3) {
|
||||||
aInfo.SetKindOfName(GEOMAlgo_KN_TRIANGLE);
|
aInfo.SetKindOfName(GEOMAlgo_KN_TRIANGLE);
|
||||||
|
//
|
||||||
|
aXYZc.SetCoord(0.,0.,0.);
|
||||||
|
TopExp::MapShapes(aF, TopAbs_VERTEX, aMV);
|
||||||
|
for (i=1; i<=aNbV; ++i) {
|
||||||
|
const TopoDS_Vertex& aV=TopoDS::Vertex(aMV(i));
|
||||||
|
aP=BRep_Tool::Pnt(aV);
|
||||||
|
const gp_XYZ& aXYZ=aP.XYZ();
|
||||||
|
aXYZc=aXYZc+aXYZ;
|
||||||
|
aPx[i-1]=aP;
|
||||||
|
}
|
||||||
|
aXYZc.Divide(3.);
|
||||||
|
//
|
||||||
|
aPc.SetXYZ(aXYZc);
|
||||||
|
gp_Vec aVX(aPc, aPx[0]);
|
||||||
|
aVX.Normalize();
|
||||||
|
aDX.SetXYZ(aVX.XYZ());
|
||||||
|
const gp_Dir& aDZ=aPln.Axis().Direction();
|
||||||
|
//
|
||||||
|
gp_Ax2 aAx2(aPc, aDZ, aDX);
|
||||||
|
gp_Ax3 aAx3(aAx2);
|
||||||
|
//
|
||||||
|
aInfo.SetLocation(aPc);
|
||||||
|
aInfo.SetPosition(aAx3);
|
||||||
|
//
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
if (!(aNbV==4 && aNbE==4)) {
|
if (!(aNbV==4 && aNbE==4)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -540,19 +569,40 @@
|
|||||||
aPC[1]=aPD;
|
aPC[1]=aPD;
|
||||||
aR[1]=0.;
|
aR[1]=0.;
|
||||||
}
|
}
|
||||||
gp_Vec aVz(aPC[0], aPC[1]);
|
|
||||||
gp_Vec aVx(aPC[0], aPX[0]);
|
|
||||||
gp_Dir aDz(aVz);
|
|
||||||
gp_Dir aDx(aVx);
|
|
||||||
gp_Ax2 aAx2(aPC[0], aDz, aDx);
|
|
||||||
gp_Ax3 aAx3(aAx2);
|
|
||||||
//
|
//
|
||||||
aHeight=aPC[0].Distance(aPC[1]);
|
aHeight=aPC[0].Distance(aPC[1]);
|
||||||
//
|
//
|
||||||
aInfo.SetLocation(aPC[0]);
|
Standard_Real aRmin, aRmax;
|
||||||
|
gp_Ax2 aAx2new;
|
||||||
|
//
|
||||||
|
if (aR[0]>aR[1]) {
|
||||||
|
aRmin=aR[1];
|
||||||
|
aRmax=aR[0];
|
||||||
|
aPc=aPC[0];
|
||||||
|
gp_Vec aVz(aPC[0], aPC[1]);
|
||||||
|
gp_Vec aVx(aPC[0], aPX[0]);
|
||||||
|
gp_Dir aDz(aVz);
|
||||||
|
gp_Dir aDx(aVx);
|
||||||
|
gp_Ax2 aAx2(aPc, aDz, aDx);
|
||||||
|
aAx2new=aAx2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aRmin=aR[0];
|
||||||
|
aRmax=aR[1];
|
||||||
|
aPc=aPC[1];
|
||||||
|
gp_Vec aVz(aPC[1], aPC[0]);
|
||||||
|
gp_Vec aVx(aPC[1], aPX[1]);
|
||||||
|
gp_Dir aDz(aVz);
|
||||||
|
gp_Dir aDx(aVx);
|
||||||
|
gp_Ax2 aAx2(aPc, aDz, aDx);
|
||||||
|
aAx2new=aAx2;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
gp_Ax3 aAx3(aAx2new);
|
||||||
|
aInfo.SetLocation(aPc);
|
||||||
aInfo.SetPosition(aAx3);
|
aInfo.SetPosition(aAx3);
|
||||||
aInfo.SetRadius1(aR[0]);
|
aInfo.SetRadius1(aRmax);
|
||||||
aInfo.SetRadius2(aR[1]);
|
aInfo.SetRadius2(aRmin);
|
||||||
aInfo.SetHeight(aHeight);
|
aInfo.SetHeight(aHeight);
|
||||||
//
|
//
|
||||||
aInfo.SetKindOfName(GEOMAlgo_KN_CONE);
|
aInfo.SetKindOfName(GEOMAlgo_KN_CONE);
|
||||||
@ -633,7 +683,11 @@
|
|||||||
}
|
}
|
||||||
aHeight=aPC[0].Distance(aPC[1]);
|
aHeight=aPC[0].Distance(aPC[1]);
|
||||||
//
|
//
|
||||||
|
gp_Ax3 aAx3=aCyl.Position();
|
||||||
|
aAx3.SetLocation(aPc);
|
||||||
|
//
|
||||||
aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER);
|
aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER);
|
||||||
|
aInfo.SetPosition(aAx3);
|
||||||
aInfo.SetLocation(aPc);
|
aInfo.SetLocation(aPc);
|
||||||
aInfo.SetHeight(aHeight);
|
aInfo.SetHeight(aHeight);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user