mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 19:09:07 +00:00
Run black, and add black to a "qa" target to make it a standardised process.
This commit is contained in:
@@ -32,6 +32,7 @@ class IfcTransitionCurveType(Enum):
|
||||
|
||||
The IfcTransitionCurveType indicates the curvature of a transition curve.
|
||||
"""
|
||||
|
||||
BIQUADRATICPARABOLA = 1 # NOTE also referred to as Schramm curve.
|
||||
BLOSSCURVE = 2
|
||||
CLOTHOIDCURVE = 3
|
||||
@@ -46,6 +47,7 @@ class TransitionCurve:
|
||||
A curve that transitions between a straight line and a circular arc
|
||||
(or the reverse).
|
||||
"""
|
||||
|
||||
StartPoint: tuple # IfcSchema::IfcCartesianPoint
|
||||
StartDirection: float # IfcSchema::IfcPlaneAngleMeasure
|
||||
SegmentLength: float # IfcSchema::IfcPositiveLengthMeasure
|
||||
@@ -57,15 +59,15 @@ class TransitionCurve:
|
||||
|
||||
def _calc_biquadratic_parabola_point(self, lpt, L, R, ccw):
|
||||
x = lpt
|
||||
if (x <= (L / 2)):
|
||||
y = x**4 / (6 * R * L**2)
|
||||
if x <= (L / 2):
|
||||
y = x ** 4 / (6 * R * L ** 2)
|
||||
else:
|
||||
|
||||
yterm_1 = (-1 * x**4) / (6 * R * L**2)
|
||||
yterm_2 = (2 * x**3) / (3 * R * L)
|
||||
yterm_3 = x**2 / (2 * R)
|
||||
yterm_1 = (-1 * x ** 4) / (6 * R * L ** 2)
|
||||
yterm_2 = (2 * x ** 3) / (3 * R * L)
|
||||
yterm_3 = x ** 2 / (2 * R)
|
||||
yterm_4 = (L * x) / (6 * R)
|
||||
yterm_5 = L**2 / (48 * R)
|
||||
yterm_5 = L ** 2 / (48 * R)
|
||||
|
||||
y = yterm_1 + yterm_2 - yterm_3 + yterm_4 - yterm_5
|
||||
|
||||
@@ -80,16 +82,16 @@ class TransitionCurve:
|
||||
def _calc_clothoid_curve_point(self, lpt, L, R, ccw):
|
||||
RL = R * L
|
||||
xterm_1 = 1
|
||||
xterm_2 = lpt**4 / (40 * RL**2)
|
||||
xterm_3 = lpt**8 / (3456 * RL**4)
|
||||
xterm_4 = lpt**12 / (599040 * RL**6)
|
||||
xterm_2 = lpt ** 4 / (40 * RL ** 2)
|
||||
xterm_3 = lpt ** 8 / (3456 * RL ** 4)
|
||||
xterm_4 = lpt ** 12 / (599040 * RL ** 6)
|
||||
x = lpt * (xterm_1 - xterm_2 + xterm_3 - xterm_4)
|
||||
|
||||
factor = lpt**3 / (6 * RL)
|
||||
factor = lpt ** 3 / (6 * RL)
|
||||
yterm_1 = 1
|
||||
yterm_2 = lpt**4 / (56 * RL**2)
|
||||
yterm_3 = lpt**8 / (7040 * RL**4)
|
||||
yterm_4 = lpt**12 / (1612800 * RL**6)
|
||||
yterm_2 = lpt ** 4 / (56 * RL ** 2)
|
||||
yterm_3 = lpt ** 8 / (7040 * RL ** 4)
|
||||
yterm_4 = lpt ** 12 / (1612800 * RL ** 6)
|
||||
|
||||
y = factor * (yterm_1 - yterm_2 + yterm_3 - yterm_4)
|
||||
|
||||
@@ -102,14 +104,14 @@ class TransitionCurve:
|
||||
pi = math.pi
|
||||
psi_x = (pi * lpt) / L
|
||||
|
||||
xterm_1 = (L**2) / (8.0 * pi**2 * R**2)
|
||||
xterm_1 = (L ** 2) / (8.0 * pi ** 2 * R ** 2)
|
||||
xterm_2 = L / pi
|
||||
xterm_3 = psi_x**3 / (3.0)
|
||||
xterm_3 = psi_x ** 3 / (3.0)
|
||||
xterm_4 = psi_x / (2.0)
|
||||
xterm_5 = (math.sin(psi_x) * math.cos(psi_x)) / (2.0)
|
||||
xterm_6 = psi_x * math.cos(psi_x)
|
||||
|
||||
x = lpt - xterm_1 * xterm_2 * ( xterm_3 + xterm_4 - xterm_5 - (2.0 * xterm_6))
|
||||
x = lpt - xterm_1 * xterm_2 * (xterm_3 + xterm_4 - xterm_5 - (2.0 * xterm_6))
|
||||
|
||||
# TODO: code for y - coordinate
|
||||
y = 0
|
||||
@@ -170,16 +172,12 @@ class TransitionCurve:
|
||||
lpt = 0.0 # length along the curve at the point to be calculated
|
||||
|
||||
for _ in range(num_intervals):
|
||||
points.append(self._calc_transition_curve_point(
|
||||
lpt, L, R, ccw, trans_type
|
||||
))
|
||||
points.append(self._calc_transition_curve_point(lpt, L, R, ccw, trans_type))
|
||||
lpt += interval_dist
|
||||
|
||||
edges = list()
|
||||
for i in range(len(points) - 1):
|
||||
edges.append(BRepBuilderAPI_MakeEdge2d(
|
||||
points[i], points[i + 1]
|
||||
))
|
||||
edges.append(BRepBuilderAPI_MakeEdge2d(points[i], points[i + 1]))
|
||||
|
||||
wire = BRepBuilderAPI_MakeWire()
|
||||
for e in edges:
|
||||
|
||||
Reference in New Issue
Block a user