1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
bugmaster
cd7814871b 0032046: Configuration - CMake Installs .lib files to libd instead of lib on Windows
Alignment of layout "Unix" behavior for Linux and Windows
2021-01-12 21:48:22 +03:00
3 changed files with 35 additions and 128 deletions

View File

@@ -199,10 +199,15 @@ endif()
set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
set (BIN_LETTER "")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Windows")
message(STATUS "Info: Windows layout was defined")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set (BIN_LETTER "d")
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
set (BIN_LETTER "i")
endif()
else()
message(STATUS "Info: Unix layout was defined")
endif()
# Get all used variables: OS_WITH_BIT, COMPILER
@@ -792,13 +797,13 @@ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
if (WIN32)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")

View File

@@ -214,7 +214,7 @@ foreach (OCCT_MODULE ${OCC_MODULES_LIST})
endif()
endforeach()
if (MSVC)
if (MSVC AND "${INSTALL_DIR_LAYOUT}" STREQUAL "Windows")
OCCT_INSERT_CODE_FOR_TARGET ()
endif()

View File

@@ -130,59 +130,6 @@ bool SelectMgr_RectangularFrustum::segmentPlaneIntersection (const gp_Vec& thePl
namespace
{
// =======================================================================
// function : intersectSegmentPlane
// purpose :
// =======================================================================
Standard_Boolean intersectSegmentPlane (const gp_Pnt& theSegPnt1, const gp_Pnt& theSegPnt2, const gp_Vec& thePlane, const gp_Pnt& thePntOnPlane, gp_Pnt& theResPnt)
{
gp_XYZ anU = theSegPnt2.XYZ() - theSegPnt1.XYZ();
gp_XYZ aW = theSegPnt1.XYZ() - thePntOnPlane.XYZ();
Standard_Real aD = thePlane.Dot(anU);
Standard_Real aN = -thePlane.Dot(aW);
if (Abs(aD) < Precision::Confusion())
{
return Standard_False;
}
Standard_Real aParam = aN / aD;
if (aParam < 0.0 || aParam > 1.0)
{
return Standard_False;
}
theResPnt = theSegPnt1.XYZ() + anU * aParam;
return Standard_True;
}
// =======================================================================
// function : projectPointOnPlane
// purpose :
// =======================================================================
gp_Pnt projectPointOnPlane (const gp_Pnt& thePnt, const gp_Vec& thePlane, const gp_Pnt& thePntOnPlane)
{
return thePnt.XYZ() - thePlane.XYZ() * (thePnt.XYZ() - thePntOnPlane.XYZ()).Dot(thePlane.XYZ());
}
// =======================================================================
// function : pointLineDistanceField
// purpose :
// =======================================================================
Standard_Real pointLineDistanceField (const gp_Pnt& thePnt, const gp_Pnt& theLinePnt1, const gp_Pnt& theLinePnt2, const gp_Pnt& thePntOnNeg, gp_Pnt& theResPntOnLine)
{
gp_XYZ aLine = theLinePnt2.XYZ() - theLinePnt1.XYZ();
gp_XYZ aW = thePnt.XYZ() - theLinePnt1.XYZ();
gp_XYZ anU = thePntOnNeg.XYZ() - theLinePnt1.XYZ();
Standard_Real aCoeff = aW.Dot (aLine) / aLine.Dot (aLine);
aCoeff = aCoeff < 0 ? 0 : aCoeff > 1 ? 1 : aCoeff;
theResPntOnLine = theLinePnt1.XYZ() + aLine * aCoeff;
return Sign (thePnt.Distance (theResPntOnLine), aW.Crossed (aLine).DotCross (aLine, anU));
}
// =======================================================================
// function : computeFrustum
// purpose : Computes base frustum data: its vertices and edge directions
@@ -744,80 +691,35 @@ Standard_Boolean SelectMgr_RectangularFrustum::Overlaps (const gp_Pnt& thePnt1,
const Standard_Boolean isInterior = (aTime >= 0.0) && (anU >= 0.0) && (aV >= 0.0) && (anU + aV <= 1.0);
const gp_Pnt aPtOnPlane = myNearPickedPnt.XYZ() + myViewRayDir.XYZ() * aTime;
if (isInterior)
{
thePickResult.SetDepth (myNearPickedPnt.Distance (aPtOnPlane) * myScale);
thePickResult.SetPickedPoint (aPtOnPlane);
thePickResult.SetSurfaceNormal (aTriangleNormal);
return !theClipRange.IsClipped (thePickResult.Depth());
}
gp_Vec aTrgNorm = aTriangleNormal.Normalized();
gp_Pnt aProjNearPnt = projectPointOnPlane (myNearPickedPnt, aTrgNorm, thePnt1);
gp_Pnt aProjFrustumPnt[4];
Standard_Integer aLastIdx = 0;
gp_Pnt aResProjPnt;
if (intersectSegmentPlane (myVertices[0], myVertices[1], aTrgNorm, thePnt1, aResProjPnt))
Standard_Real aMinDist = RealLast();
Standard_Integer aNearestEdgeIdx1 = -1;
for (Standard_Integer anEdgeIdx = 0; anEdgeIdx < 3; ++anEdgeIdx)
{
aProjFrustumPnt[aLastIdx++] = aResProjPnt;
}
if (intersectSegmentPlane (myVertices[2], myVertices[3], aTrgNorm, thePnt1, aResProjPnt))
gp_XYZ aW = aPtOnPlane.XYZ() - aPnts[anEdgeIdx].XYZ();
Standard_Real aCoef = aTrEdges[anEdgeIdx].Dot (aW) / aTrEdges[anEdgeIdx].Dot (aTrEdges[anEdgeIdx]);
Standard_Real aDist = aPtOnPlane.Distance (aPnts[anEdgeIdx].XYZ() + aCoef * aTrEdges[anEdgeIdx]);
if (aDist < aMinDist)
{
aProjFrustumPnt[aLastIdx++] = aResProjPnt;
}
if (intersectSegmentPlane (myVertices[6], myVertices[7], aTrgNorm, thePnt1, aResProjPnt))
{
aProjFrustumPnt[aLastIdx++] = aResProjPnt;
}
if (intersectSegmentPlane (myVertices[4], myVertices[5], aTrgNorm, thePnt1, aResProjPnt))
{
aProjFrustumPnt[aLastIdx++] = aResProjPnt;
}
// Distance from projected myNearPickedPnt to projected fructum rectangle,
// inside distance is 0, outside distance is positive
gp_Pnt aNearPntOnFrustumRect;
Standard_Real aDistToFrustumRect = -RealLast();
for (Standard_Integer aVertIdx = 0; aVertIdx < aLastIdx && aLastIdx > 1; ++aVertIdx)
{
gp_Pnt aTmpPnt;
Standard_Real aDist = pointLineDistanceField (aProjNearPnt, aProjFrustumPnt[aVertIdx], aProjFrustumPnt[(aVertIdx + 1) % aLastIdx], aPtOnPlane, aTmpPnt);
if (aDist > aDistToFrustumRect)
{
aDistToFrustumRect = aDist;
aNearPntOnFrustumRect = aTmpPnt;
aMinDist = aDist;
aNearestEdgeIdx1 = anEdgeIdx;
}
}
if (aDistToFrustumRect < 0)
Standard_Integer aNearestEdgeIdx2 = (aNearestEdgeIdx1 + 1) % 3;
const gp_Vec aVec12 (aPnts[aNearestEdgeIdx1], aPnts[aNearestEdgeIdx2]);
if (aVec12.SquareMagnitude() > gp::Resolution()
&& myViewRayDir.IsParallel (aVec12, Precision::Angular()))
{
aNearPntOnFrustumRect = aProjNearPnt;
aDistToFrustumRect = 0;
aNearestEdgeIdx2 = aNearestEdgeIdx1 == 0 ? 2 : aNearestEdgeIdx1 - 1;
}
// Distance from projected myNearPickedPnt to triangle,
// inside distance is 0, outside distance is positive
gp_Pnt aNearPntOnTriangle;
Standard_Real aDistToTriangle = -RealLast();
for (Standard_Integer aVertIdx = 0; aVertIdx < 3; ++aVertIdx)
{
gp_Pnt aTmpPnt;
Standard_Real aDist = pointLineDistanceField (aProjNearPnt, aPnts[aVertIdx], aPnts[(aVertIdx + 1) % 3], aPnts[(aVertIdx + 2) % 3], aTmpPnt);
if (aDist > aDistToTriangle)
{
aDistToTriangle = aDist;
aNearPntOnTriangle = aTmpPnt;
}
}
if (aDistToTriangle < 0)
{
aNearPntOnTriangle = aProjNearPnt;
aDistToTriangle = 0;
}
// Combining distances
gp_Pnt aResPnt = aDistToFrustumRect > aDistToTriangle ? aNearPntOnFrustumRect : aNearPntOnTriangle;
thePickResult.SetDepth (myNearPickedPnt.Distance (aResPnt) * myScale);
thePickResult.SetPickedPoint (aResPnt);
segmentSegmentDistance (aPnts[aNearestEdgeIdx1], aPnts[aNearestEdgeIdx2], thePickResult);
}
return !theClipRange.IsClipped (thePickResult.Depth());