Skip to content

sync with upstream #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/cpp/web-ifc/geometry/operations/bim-geometry/profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ namespace bimGeometry
{
profile = bimGeometry::GetUShapedCurve(width, depth, thickness, flangeThickness, filletRadius, radius, slope, _placement);
}
if(pType == 6)
{
profile = bimGeometry::GetRectangleCurve(width, depth, _placement);
}
if(pType == 7)
{
profile = bimGeometry::GetTrapeziumCurve(width, thickness, depth, flangeThickness, _placement);
}


for (int r = 0; r < profile.points.size(); r++)
Expand Down
16 changes: 8 additions & 8 deletions src/cpp/web-ifc/geometry/operations/bim-geometry/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -1260,11 +1260,11 @@ namespace bimGeometry
double halfX = xdim / 2;
double halfY = ydim / 2;

glm::dvec2 bl = placement * glm::dvec3(-halfX, -halfY, 1);
glm::dvec2 br = placement * glm::dvec3(halfX, -halfY, 1);
glm::dvec3 bl = placement * glm::dvec3(-halfX, -halfY, 1);
glm::dvec3 br = placement * glm::dvec3(halfX, -halfY, 1);

glm::dvec2 tl = placement * glm::dvec3(-halfX, halfY, 1);
glm::dvec2 tr = placement * glm::dvec3(halfX, halfY, 1);
glm::dvec3 tl = placement * glm::dvec3(-halfX, halfY, 1);
glm::dvec3 tr = placement * glm::dvec3(halfX, halfY, 1);

Curve c;
c.Add(bl);
Expand Down Expand Up @@ -1524,11 +1524,11 @@ namespace bimGeometry
double halfX = bottomXDim / 2;
double halfY = yDim / 2;

glm::dvec2 bl = placement * glm::dvec3(-halfX, -halfY, 1);
glm::dvec2 br = placement * glm::dvec3(halfX, -halfY, 1);
glm::dvec3 bl = placement * glm::dvec3(-halfX, -halfY, 1);
glm::dvec3 br = placement * glm::dvec3(halfX, -halfY, 1);

glm::dvec2 tl = placement * glm::dvec3(-halfX + topXOffset, halfY, 1);
glm::dvec2 tr = placement * glm::dvec3(-halfX + topXOffset + topXDim, halfY, 1);
glm::dvec3 tl = placement * glm::dvec3(-halfX + topXOffset, halfY, 1);
glm::dvec3 tr = placement * glm::dvec3(-halfX + topXOffset + topXDim, halfY, 1);

Curve c;
c.Add(bl);
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/web-ifc/geometry/operations/boolean-utils/clip-mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ namespace fuzzybools
auto isInside1Loc = isInsideMesh(triCenter, n, *bvh1.ptr, bvh1, raydir);
auto isInside2Loc = isInsideMesh(triCenter, n, *bvh2.ptr, bvh2, raydir);

Vec extraDir1 = glm::normalize(Vec(1.1, 1.4, 1.2));
Vec extraDir2 = glm::normalize(Vec(-2.1, 1.4, -3.2));
Vec extraDir1 = glm::normalize(raydir + Vec(0.02,0.01,0.04));
Vec extraDir2 = glm::normalize(raydir + Vec(0.20,-0.1,0.40));

auto isInside1Loc_B = isInsideMesh(triCenter, n, *bvh1.ptr, bvh1, extraDir1);
auto isInside2Loc_B = isInsideMesh(triCenter, n, *bvh2.ptr, bvh2, extraDir1);
Expand Down
22 changes: 10 additions & 12 deletions src/cpp/web-ifc/geometry/operations/boolean-utils/is-inside-mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
/*
This function was revised on 2024-03-17. Further review is needed once we have an overview
of the entire package.

Parameter normal is assumed to be normalised.
Function computeNormal returns a normalised vector.

The constants toleranceBoundaryPoint and toleranceParallel are defined in eps.h.
*/
#pragma once
#pragma once

#include <glm/glm.hpp>
#include <iostream>
Expand All @@ -37,22 +37,20 @@ namespace fuzzybools
Vec normal;
};

inline InsideResult isInsideMesh
(
const Vec& pt,
inline InsideResult isInsideMesh(
const Vec &pt,
Vec normal,
const Geometry& g,
BVH& bvh,
const Geometry &g,
BVH &bvh,
Vec dir = Vec(1.0, 1.1, 1.4),
bool UNION = false
)
bool UNION = false)
{
int winding = 0;
dir = dir + Vec(0.02,0.01,0.04); //Randomly changing the normal to create a truly random direction for raytrace
dir = dir + Vec(0.02, 0.01, 0.04); // Randomly changing the normal to create a truly random direction for raytrace
InsideResult result;
result.loc = MeshLocation::BOUNDARY;
result.normal = glm::dvec3(0);

double dirLength = dir.length();

bool hasResult = bvh.IntersectRay(pt, dir, [&](uint32_t i) -> bool
Expand Down
Loading