fix: Correct ElCLib 2D/3D conversion function calls
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
+41
-41
@@ -84,9 +84,9 @@ void LineTool::mousePressEvent(QMouseEvent *event)
|
||||
gp_Pnt mousePnt(currentMouseWorldPos.x(), currentMouseWorldPos.y(), currentMouseWorldPos.z());
|
||||
gp_Dir refDirGp(refDir.x(), refDir.y(), refDir.z());
|
||||
|
||||
gp_Pnt2d startPnt2d = ElCLib::To2d(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::To2d(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::To2d(plane, refDirGp);
|
||||
gp_Pnt2d startPnt2d = ElCLib::Value(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::Value(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::Direction(plane, refDirGp);
|
||||
|
||||
gp_Vec2d mouseVec2d(startPnt2d, mousePnt2d);
|
||||
double mouseAngle = qRadiansToDegrees(atan2(mouseVec2d.Y(), mouseVec2d.X()));
|
||||
@@ -106,7 +106,7 @@ void LineTool::mousePressEvent(QMouseEvent *event)
|
||||
}
|
||||
double finalAngleRad = qDegreesToRadians(refAngle + snappedAngle);
|
||||
gp_Dir2d finalDir2d(cos(finalAngleRad), sin(finalAngleRad));
|
||||
gp_Dir finalDir3d = ElCLib::To3d(finalDir2d, plane);
|
||||
gp_Dir finalDir3d = ElCLib::Direction(finalDir2d, plane);
|
||||
QVector3D finalDir(finalDir3d.X(), finalDir3d.Y(), finalDir3d.Z());
|
||||
double lineLength;
|
||||
if (lengthFromInput) lineLength = inputLength;
|
||||
@@ -137,14 +137,14 @@ void LineTool::mousePressEvent(QMouseEvent *event)
|
||||
gp_Pnt worldPos(worldPosQ.x(), worldPosQ.y(), worldPosQ.z());
|
||||
|
||||
if (m_viewport->isSnappingHorizontal() || m_viewport->isSnappingVertical()) {
|
||||
gp_Pnt2d worldPos2d = ElCLib::To2d(worldPos, plane);
|
||||
gp_Pnt2d firstPoint2d = ElCLib::To2d(m_firstLinePoint, plane);
|
||||
gp_Pnt2d worldPos2d = ElCLib::Value(worldPos, plane);
|
||||
gp_Pnt2d firstPoint2d = ElCLib::Value(m_firstLinePoint, plane);
|
||||
if (m_viewport->isSnappingHorizontal()) {
|
||||
worldPos2d.SetY(firstPoint2d.Y());
|
||||
} else { // vertical
|
||||
worldPos2d.SetX(firstPoint2d.X());
|
||||
}
|
||||
worldPos = ElCLib::To3d(worldPos2d, plane);
|
||||
worldPos = ElCLib::Value(worldPos2d, plane);
|
||||
}
|
||||
p = worldPos;
|
||||
}
|
||||
@@ -187,8 +187,8 @@ void LineTool::mouseMoveEvent(QMouseEvent *event)
|
||||
gp_Pnt worldPos(worldPosQ.x(), worldPosQ.y(), worldPosQ.z());
|
||||
gp_Pnt startPos = m_firstLinePoint;
|
||||
|
||||
gp_Pnt2d worldPos2d = ElCLib::To2d(worldPos, plane);
|
||||
gp_Pnt2d startPos2d = ElCLib::To2d(startPos, plane);
|
||||
gp_Pnt2d worldPos2d = ElCLib::Value(worldPos, plane);
|
||||
gp_Pnt2d startPos2d = ElCLib::Value(startPos, plane);
|
||||
gp_Vec2d delta(startPos2d, worldPos2d);
|
||||
|
||||
if (delta.Magnitude() > 1e-6) {
|
||||
@@ -250,9 +250,9 @@ void LineTool::finalizeCreation()
|
||||
gp_Pnt mousePnt(currentMouseWorldPos.x(), currentMouseWorldPos.y(), currentMouseWorldPos.z());
|
||||
gp_Dir refDirGp(refDir.x(), refDir.y(), refDir.z());
|
||||
|
||||
gp_Pnt2d startPnt2d = ElCLib::To2d(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::To2d(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::To2d(plane, refDirGp);
|
||||
gp_Pnt2d startPnt2d = ElCLib::Value(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::Value(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::Direction(plane, refDirGp);
|
||||
|
||||
gp_Vec2d mouseVec2d(startPnt2d, mousePnt2d);
|
||||
double mouseAngle = qRadiansToDegrees(atan2(mouseVec2d.Y(), mouseVec2d.X()));
|
||||
@@ -272,7 +272,7 @@ void LineTool::finalizeCreation()
|
||||
}
|
||||
double finalAngleRad = qDegreesToRadians(refAngle + snappedAngle);
|
||||
gp_Dir2d finalDir2d(cos(finalAngleRad), sin(finalAngleRad));
|
||||
gp_Dir finalDir3d = ElCLib::To3d(finalDir2d, plane);
|
||||
gp_Dir finalDir3d = ElCLib::Direction(finalDir2d, plane);
|
||||
QVector3D finalDir(finalDir3d.X(), finalDir3d.Y(), finalDir3d.Z());
|
||||
double lineLength;
|
||||
if (lengthFromInput) lineLength = inputLength;
|
||||
@@ -354,9 +354,9 @@ void LineTool::paintGL()
|
||||
gp_Pnt mousePnt(currentMouseWorldPos.x(), currentMouseWorldPos.y(), currentMouseWorldPos.z());
|
||||
gp_Dir refDirGp(refDir.x(), refDir.y(), refDir.z());
|
||||
|
||||
gp_Pnt2d startPnt2d = ElCLib::To2d(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::To2d(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::To2d(plane, refDirGp);
|
||||
gp_Pnt2d startPnt2d = ElCLib::Value(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::Value(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::Direction(plane, refDirGp);
|
||||
|
||||
gp_Vec2d mouseVec2d(startPnt2d, mousePnt2d);
|
||||
double mouseAngle = qRadiansToDegrees(atan2(mouseVec2d.Y(), mouseVec2d.X()));
|
||||
@@ -379,7 +379,7 @@ void LineTool::paintGL()
|
||||
|
||||
double finalAngleRad = qDegreesToRadians(refAngle + snappedAngle);
|
||||
gp_Dir2d finalDir2d(cos(finalAngleRad), sin(finalAngleRad));
|
||||
gp_Dir finalDir3d = ElCLib::To3d(finalDir2d, plane);
|
||||
gp_Dir finalDir3d = ElCLib::Direction(finalDir2d, plane);
|
||||
QVector3D finalDir(finalDir3d.X(), finalDir3d.Y(), finalDir3d.Z());
|
||||
|
||||
double lineLength;
|
||||
@@ -410,14 +410,14 @@ void LineTool::paintGL()
|
||||
} else if (m_viewport->isSnappingVertex()) {
|
||||
worldPosPnt = m_viewport->snapVertex();
|
||||
} else if (m_viewport->isSnappingHorizontal() || m_viewport->isSnappingVertical()) {
|
||||
gp_Pnt2d worldPos2d = ElCLib::To2d(worldPosPnt, plane);
|
||||
gp_Pnt2d firstPoint2d = ElCLib::To2d(m_firstLinePoint, plane);
|
||||
gp_Pnt2d worldPos2d = ElCLib::Value(worldPosPnt, plane);
|
||||
gp_Pnt2d firstPoint2d = ElCLib::Value(m_firstLinePoint, plane);
|
||||
if (m_viewport->isSnappingHorizontal()) {
|
||||
worldPos2d.SetY(firstPoint2d.Y());
|
||||
} else { // vertical
|
||||
worldPos2d.SetX(firstPoint2d.X());
|
||||
}
|
||||
worldPosPnt = ElCLib::To3d(worldPos2d, plane);
|
||||
worldPosPnt = ElCLib::Value(worldPos2d, plane);
|
||||
}
|
||||
worldPos.setX(worldPosPnt.X()); worldPos.setY(worldPosPnt.Y()); worldPos.setZ(worldPosPnt.Z());
|
||||
}
|
||||
@@ -453,9 +453,9 @@ void LineTool::paintGL()
|
||||
gp_Pnt mousePnt(currentMouseWorldPos.x(), currentMouseWorldPos.y(), currentMouseWorldPos.z());
|
||||
gp_Dir refDirGp(refDir.x(), refDir.y(), refDir.z());
|
||||
|
||||
gp_Pnt2d startPnt2d = ElCLib::To2d(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::To2d(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::To2d(plane, refDirGp);
|
||||
gp_Pnt2d startPnt2d = ElCLib::Value(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::Value(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::Direction(plane, refDirGp);
|
||||
|
||||
gp_Vec2d mouseVec2d(startPnt2d, mousePnt2d);
|
||||
double mouseAngle = qRadiansToDegrees(atan2(mouseVec2d.Y(), mouseVec2d.X()));
|
||||
@@ -477,8 +477,8 @@ void LineTool::paintGL()
|
||||
gp_Dir refDirGp(refDir.x(), refDir.y(), refDir.z());
|
||||
gp_Dir lineDirGp(lineVec.x(), lineVec.y(), lineVec.z());
|
||||
|
||||
gp_Dir2d refDir2d = ElCLib::To2d(plane, refDirGp);
|
||||
gp_Dir2d lineDir2d = ElCLib::To2d(plane, lineDirGp);
|
||||
gp_Dir2d refDir2d = ElCLib::Direction(plane, refDirGp);
|
||||
gp_Dir2d lineDir2d = ElCLib::Direction(plane, lineDirGp);
|
||||
|
||||
refAngle = atan2(refDir2d.Y(), refDir2d.X());
|
||||
lineAngle = atan2(lineDir2d.Y(), lineDir2d.X());
|
||||
@@ -492,9 +492,9 @@ void LineTool::paintGL()
|
||||
vertices.clear();
|
||||
|
||||
gp_Dir lineDirGp(lineVec.x(), lineVec.y(), lineVec.z());
|
||||
gp_Dir2d lineDir2d = ElCLib::To2d(plane, lineDirGp);
|
||||
gp_Dir2d lineDir2d = ElCLib::Direction(plane, lineDirGp);
|
||||
gp_Dir2d perpDir2d(-lineDir2d.Y(), lineDir2d.X());
|
||||
gp_Dir perpDir3d = ElCLib::To3d(perpDir2d, plane);
|
||||
gp_Dir perpDir3d = ElCLib::Direction(perpDir2d, plane);
|
||||
QVector3D perpVec(perpDir3d.X(), perpDir3d.Y(), perpDir3d.Z());
|
||||
|
||||
if (angleDiff < 0) {
|
||||
@@ -670,9 +670,9 @@ void LineTool::paint2D(QPainter& painter, const QMatrix4x4& modelView, const QMa
|
||||
gp_Pnt mousePnt(currentMouseWorldPos.x(), currentMouseWorldPos.y(), currentMouseWorldPos.z());
|
||||
gp_Dir refDirGp(refDir.x(), refDir.y(), refDir.z());
|
||||
|
||||
gp_Pnt2d startPnt2d = ElCLib::To2d(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::To2d(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::To2d(plane, refDirGp);
|
||||
gp_Pnt2d startPnt2d = ElCLib::Value(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::Value(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::Direction(plane, refDirGp);
|
||||
|
||||
gp_Vec2d mouseVec2d(startPnt2d, mousePnt2d);
|
||||
double mouseAngle = qRadiansToDegrees(atan2(mouseVec2d.Y(), mouseVec2d.X()));
|
||||
@@ -695,7 +695,7 @@ void LineTool::paint2D(QPainter& painter, const QMatrix4x4& modelView, const QMa
|
||||
|
||||
double finalAngleRad = qDegreesToRadians(refAngle + snappedAngle);
|
||||
gp_Dir2d finalDir2d(cos(finalAngleRad), sin(finalAngleRad));
|
||||
gp_Dir finalDir3d = ElCLib::To3d(finalDir2d, plane);
|
||||
gp_Dir finalDir3d = ElCLib::Direction(finalDir2d, plane);
|
||||
QVector3D finalDir(finalDir3d.X(), finalDir3d.Y(), finalDir3d.Z());
|
||||
|
||||
if (lengthFromInput) {
|
||||
@@ -726,14 +726,14 @@ void LineTool::paint2D(QPainter& painter, const QMatrix4x4& modelView, const QMa
|
||||
} else if (m_viewport->isSnappingVertex()) {
|
||||
worldPosPnt = m_viewport->snapVertex();
|
||||
} else if (m_viewport->isSnappingHorizontal() || m_viewport->isSnappingVertical()) {
|
||||
gp_Pnt2d worldPos2d = ElCLib::To2d(worldPosPnt, plane);
|
||||
gp_Pnt2d firstPoint2d = ElCLib::To2d(m_firstLinePoint, plane);
|
||||
gp_Pnt2d worldPos2d = ElCLib::Value(worldPosPnt, plane);
|
||||
gp_Pnt2d firstPoint2d = ElCLib::Value(m_firstLinePoint, plane);
|
||||
if (m_viewport->isSnappingHorizontal()) {
|
||||
worldPos2d.SetY(firstPoint2d.Y());
|
||||
} else { // vertical
|
||||
worldPos2d.SetX(firstPoint2d.X());
|
||||
}
|
||||
worldPosPnt = ElCLib::To3d(worldPos2d, plane);
|
||||
worldPosPnt = ElCLib::Value(worldPos2d, plane);
|
||||
}
|
||||
worldPos.setX(worldPosPnt.X()); worldPos.setY(worldPosPnt.Y()); worldPos.setZ(worldPosPnt.Z());
|
||||
lineLength = (worldPos - startPos).length();
|
||||
@@ -759,9 +759,9 @@ void LineTool::paint2D(QPainter& painter, const QMatrix4x4& modelView, const QMa
|
||||
gp_Pnt mousePnt(currentMouseWorldPosForText.x(), currentMouseWorldPosForText.y(), currentMouseWorldPosForText.z());
|
||||
gp_Dir refDirGp(refDir.x(), refDir.y(), refDir.z());
|
||||
|
||||
gp_Pnt2d startPnt2d = ElCLib::To2d(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::To2d(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::To2d(plane, refDirGp);
|
||||
gp_Pnt2d startPnt2d = ElCLib::Value(startPnt, plane);
|
||||
gp_Pnt2d mousePnt2d = ElCLib::Value(mousePnt, plane);
|
||||
gp_Dir2d refDir2d = ElCLib::Direction(plane, refDirGp);
|
||||
|
||||
gp_Vec2d mouseVec2d(startPnt2d, mousePnt2d);
|
||||
double mouseAngle = qRadiansToDegrees(atan2(mouseVec2d.Y(), mouseVec2d.X()));
|
||||
@@ -784,8 +784,8 @@ void LineTool::paint2D(QPainter& painter, const QMatrix4x4& modelView, const QMa
|
||||
gp_Dir refDirGp(refDir.x(), refDir.y(), refDir.z());
|
||||
gp_Dir lineDirGp(lineVec.x(), lineVec.y(), lineVec.z());
|
||||
|
||||
gp_Dir2d refDir2d = ElCLib::To2d(plane, refDirGp);
|
||||
gp_Dir2d lineDir2d = ElCLib::To2d(plane, lineDirGp);
|
||||
gp_Dir2d refDir2d = ElCLib::Direction(plane, refDirGp);
|
||||
gp_Dir2d lineDir2d = ElCLib::Direction(plane, lineDirGp);
|
||||
|
||||
refAngle = atan2(refDir2d.Y(), refDir2d.X());
|
||||
lineAngle = atan2(lineDir2d.Y(), lineDir2d.X());
|
||||
@@ -796,9 +796,9 @@ void LineTool::paint2D(QPainter& painter, const QMatrix4x4& modelView, const QMa
|
||||
lineAngle = refAngle + angleDiff;
|
||||
|
||||
gp_Dir lineDirGp(lineVec.x(), lineVec.y(), lineVec.z());
|
||||
gp_Dir2d lineDir2d = ElCLib::To2d(plane, lineDirGp);
|
||||
gp_Dir2d lineDir2d = ElCLib::Direction(plane, lineDirGp);
|
||||
gp_Dir2d perpDir2d(-lineDir2d.Y(), lineDir2d.X());
|
||||
gp_Dir perpDir3d = ElCLib::To3d(perpDir2d, plane);
|
||||
gp_Dir perpDir3d = ElCLib::Direction(perpDir2d, plane);
|
||||
QVector3D perpVec(perpDir3d.X(), perpDir3d.Y(), perpDir3d.Z());
|
||||
|
||||
if (angleDiff < 0) {
|
||||
|
||||
Reference in New Issue
Block a user