MCPcopy Index your code
hub / github.com/CadQuery/cadquery / fixed_rotation_cost

Function fixed_rotation_cost

cadquery/occ_impl/solver.py:529–546  ·  view source on GitHub ↗
(
    problem,
    m1: Type[None],
    T1_0,
    R1_0,
    T1,
    R1,
    val: Tuple[float, float, float],
    scale: float = 1,
)

Source from the content-addressed store, hash-verified

527
528
529def fixed_rotation_cost(
530 problem,
531 m1: Type[None],
532 T1_0,
533 R1_0,
534 T1,
535 R1,
536 val: Tuple[float, float, float],
537 scale: float = 1,
538):
539
540 q = gp_Quaternion()
541 q.SetEulerAngles(gp_Extrinsic_XYZ, *val)
542 q_dm = ca.DM((q.W(), q.X(), q.Y(), q.Z()))
543
544 dummy = 1 - ca.dot(ca.vertcat(*Quaternion(R1_0 + R1)), q_dm) ** 2
545
546 return dummy
547
548
549# dictionary of individual constraint cost functions

Callers

nothing calls this directly

Calls 2

QuaternionFunction · 0.85
dotMethod · 0.80

Tested by

no test coverage detected