Figures out the X direction based on the given normal. :param normal: The direction that's normal to the plane. :type normal: A Vector :return A vector representing the X direction.
(normal)
| 520 | return abs(n0.dot(p0.sub(p1))) < self.ctx.tolerance |
| 521 | |
| 522 | def _computeXdir(normal): |
| 523 | """ |
| 524 | Figures out the X direction based on the given normal. |
| 525 | |
| 526 | :param normal: The direction that's normal to the plane. |
| 527 | :type normal: A Vector |
| 528 | :return A vector representing the X direction. |
| 529 | """ |
| 530 | xd = Vector(0, 0, 1).cross(normal) |
| 531 | if xd.Length < self.ctx.tolerance: |
| 532 | # this face is parallel with the x-y plane, so choose x to be in global coordinates |
| 533 | xd = Vector(1, 0, 0) |
| 534 | return xd |
| 535 | |
| 536 | if centerOption not in {"CenterOfMass", "ProjectedOrigin", "CenterOfBoundBox"}: |
| 537 | raise ValueError("Undefined centerOption value provided.") |