Finds the start point for an operation when an existing point is implied. Examples include 2d operations such as lineTo, which allows specifying the end point, and implicitly use the end of the previous line as the starting point :return: a Vector represent
(self, useLocalCoords: bool = False)
| 1330 | return ns |
| 1331 | |
| 1332 | def _findFromPoint(self, useLocalCoords: bool = False) -> Vector: |
| 1333 | """ |
| 1334 | Finds the start point for an operation when an existing point |
| 1335 | is implied. Examples include 2d operations such as lineTo, |
| 1336 | which allows specifying the end point, and implicitly use the |
| 1337 | end of the previous line as the starting point |
| 1338 | |
| 1339 | :return: a Vector representing the point to use, or none if |
| 1340 | such a point is not available. |
| 1341 | |
| 1342 | :param useLocalCoords: selects whether the point is returned |
| 1343 | in local coordinates or global coordinates. |
| 1344 | |
| 1345 | The algorithm is this: |
| 1346 | * If an Edge is on the stack, its end point is used.yp |
| 1347 | * if a vector is on the stack, it is used |
| 1348 | |
| 1349 | WARNING: only the last object on the stack is used. |
| 1350 | |
| 1351 | """ |
| 1352 | obj = self.objects[-1] if self.objects else self.plane.origin |
| 1353 | |
| 1354 | if isinstance(obj, Edge): |
| 1355 | p = obj.endPoint() |
| 1356 | elif isinstance(obj, Vector): |
| 1357 | p = obj |
| 1358 | elif isinstance(obj, Vertex): |
| 1359 | p = obj.Center() |
| 1360 | else: |
| 1361 | raise ValueError(f"Cannot convert object type {type(obj)} to vector.") |
| 1362 | |
| 1363 | if useLocalCoords: |
| 1364 | return self.plane.toLocalCoords(p) |
| 1365 | else: |
| 1366 | return p |
| 1367 | |
| 1368 | def _findFromEdge(self, useLocalCoords: bool = False) -> Edge: |
| 1369 | """ |
no test coverage detected