Function
point_in_plane_cost
(
problem,
m1: gp_Pnt,
m2: gp_Pln,
T1_0,
R1_0,
T2_0,
R2_0,
T1,
R1,
T2,
R2,
val: Optional[float] = None,
scale: float = 1,
)
Source from the content-addressed store, hash-verified
| 398 | |
| 399 | |
| 400 | def point_in_plane_cost( |
| 401 | problem, |
| 402 | m1: gp_Pnt, |
| 403 | m2: gp_Pln, |
| 404 | T1_0, |
| 405 | R1_0, |
| 406 | T2_0, |
| 407 | R2_0, |
| 408 | T1, |
| 409 | R1, |
| 410 | T2, |
| 411 | R2, |
| 412 | val: Optional[float] = None, |
| 413 | scale: float = 1, |
| 414 | ) -> float: |
| 415 | |
| 416 | val = 0 if val is None else val |
| 417 | |
| 418 | m1_dm = ca.DM((m1.X(), m1.Y(), m1.Z())) |
| 419 | |
| 420 | m2_dir = m2.Axis().Direction() |
| 421 | m2_pnt = m2.Axis().Location().Translated(val * gp_Vec(m2_dir)) |
| 422 | |
| 423 | m2_dir_dm = ca.DM((m2_dir.X(), m2_dir.Y(), m2_dir.Z())) |
| 424 | m2_pnt_dm = ca.DM((m2_pnt.X(), m2_pnt.Y(), m2_pnt.Z())) |
| 425 | |
| 426 | dummy = ( |
| 427 | ca.dot( |
| 428 | Rotate(m2_dir_dm, R2_0 + R2), |
| 429 | Transform(m2_pnt_dm, T2_0 + T2, R2_0 + R2) |
| 430 | - Transform(m1_dm, T1_0 + T1, R1_0 + R1), |
| 431 | ) |
| 432 | / scale |
| 433 | ) |
| 434 | |
| 435 | return dummy ** 2 |
| 436 | |
| 437 | |
| 438 | def point_on_line_cost( |
Callers
nothing calls this directly
Tested by
no test coverage detected