mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 00:07:53 +00:00
Fixed bug in shape_builder.mep_transition_calculate
it wasn't taking account that `h` can also end up negative
This commit is contained in:
@@ -1160,10 +1160,11 @@ class ShapeBuilder:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
h = (a + b + sqrt(h0)) / (2 * t)
|
h = (a + b + sqrt(h0)) / (2 * t)
|
||||||
if h < abs(offset.y) or is_x(h, offset.y):
|
length_squared = h**2 - offset.y**2
|
||||||
|
if length_squared <= 0:
|
||||||
print(f"B. angle = {angle} requires h = {h} which is not possible with y offset = {offset.y}")
|
print(f"B. angle = {angle} requires h = {h} which is not possible with y offset = {offset.y}")
|
||||||
return None
|
return None
|
||||||
length = sqrt(h**2 - offset.y**2)
|
length = sqrt(length_squared)
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
A = (end_half_dim if end_profile else start_half_dim) * V(1, 0, 0)
|
A = (end_half_dim if end_profile else start_half_dim) * V(1, 0, 0)
|
||||||
@@ -1178,10 +1179,11 @@ class ShapeBuilder:
|
|||||||
if is_x(offset.x, 0):
|
if is_x(offset.x, 0):
|
||||||
angle = 90 # NOTE: for now we just hardcode the good value for that case
|
angle = 90 # NOTE: for now we just hardcode the good value for that case
|
||||||
h = start_half_dim.x / tan(radians(angle / 2))
|
h = start_half_dim.x / tan(radians(angle / 2))
|
||||||
if h < abs(offset.y) or is_x(h, offset.y):
|
length_squared = h**2 - offset.y**2
|
||||||
|
if length_squared <= 0:
|
||||||
print(f"B. angle = {angle} requires h = {h} which is not possible with y offset = {offset.y}")
|
print(f"B. angle = {angle} requires h = {h} which is not possible with y offset = {offset.y}")
|
||||||
return None
|
return None
|
||||||
length = sqrt(h**2 - offset.y**2)
|
length = sqrt(length_squared)
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
O = V(0, 0, 0)
|
O = V(0, 0, 0)
|
||||||
@@ -1191,10 +1193,11 @@ class ShapeBuilder:
|
|||||||
print(f"B. length = {length}, requested angle = {angle}, tested angle = {tested_angle}")
|
print(f"B. length = {length}, requested angle = {angle}, tested angle = {tested_angle}")
|
||||||
else:
|
else:
|
||||||
h = offset.x / tan(radians(angle))
|
h = offset.x / tan(radians(angle))
|
||||||
if h < abs(offset.y) or is_x(h, offset.y):
|
length_squared = h**2 - offset.y**2
|
||||||
|
if length_squared <= 0:
|
||||||
print(f"C. angle = {angle} requires h = {h} which is not possible with y offset = {offset.y}")
|
print(f"C. angle = {angle} requires h = {h} which is not possible with y offset = {offset.y}")
|
||||||
return None
|
return None
|
||||||
length = sqrt(h**2 - offset.y**2)
|
length = sqrt(length_squared)
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
A = V(-start_half_dim.x, 0, 0)
|
A = V(-start_half_dim.x, 0, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user