@@ -397,108 +397,6 @@ regularly required when working on geometrical problems.
397
397
Axis-Aligned Line
398
398
-----------------
399
399
400
- This class provides functions related to axis aligned lines as well as
401
- acting as a convienent container for them. In this context, an axis
402
- aligned line is a two-dimensional line that is defined by an axis and
403
- length on that axis, rather than two points. When working with two lines
404
- defined as such that have the same axis, many calculations are
405
- simplified.
406
-
407
- .. class :: AxisAlignedLine
408
-
409
- Defines an undirected two-dimensional line by an axis, a minimum and a maximum.
410
-
411
- .. note ::
412
-
413
- Though it requires the same amount of memory as a simple representation of
414
- a 2 dimensional line (4 numerics), it cannot describe all types of lines.
415
- All lines that can be defined this way intersect (0, 0).
416
-
417
- .. note ::
418
-
419
- `min ` and `max ` are referring to nearness to negative and positive infinity,
420
- respectively. The absolute value of `min ` may be larger than that of `max `.
421
-
422
- .. note ::
423
-
424
- AxisAlignedLines are an intermediary operation, so offsets should be baked
425
- into them.
426
-
427
- .. attribute :: AxisAlignedLine.axis
428
-
429
- `Vector2 ` the axis this line is along.
430
-
431
- .. attribute :: AxisAlignedLine.min
432
-
433
- `numeric ` the number (closest to negative infinity) that is still on this
434
- line when walked along the axis. If negative, it may have a greater absolute
435
- value than max and implies walking in the opposite direction of the axis.
436
-
437
- .. attribute :: AxisAlignedLine.max
438
-
439
- `numeric ` the number (closest to positive infinity) that is still on this
440
- line when walked along the axis. If negative, it may have a smaller absolute
441
- value than min and implies walking in the opposite direction of the axis.
442
-
443
- .. method :: AxisAlignedLine(self, axis, point1, point2)
444
-
445
- - **axis ** - `Vector2 ` axis this line is on
446
- - **point1 ** - `numeric ` one point on this line
447
- - **point2 ** - `numeric ` a different point on this line
448
-
449
- Construct an axis aligned line with the appropriate min and max.
450
-
451
- .. staticmethod :: AxisAlignedLine.intersects(line1, line2)
452
-
453
- - **line1 ** - `AxisAlignedLine ` the first line
454
- - **line2 ** - `AxisAlignedLine ` the second line
455
- - **Return Value ** - `bool, bool ` touching, overlapping
456
-
457
- Determine if the two lines are touching and if they are, if
458
- they are overlapping. Lines are touching if they share only
459
- one end point, whereas they are overlapping if they share
460
- infinitely many points.
461
-
462
- .. note ::
463
-
464
- It is rarely faster to check intersection before finding intersection if
465
- you will need the minimum translation vector, since they do mostly
466
- the same operations.
467
-
468
- .. staticmethod :: AxisAlignedLine.find_intersection(line1, line2)
469
-
470
- - **line1 ** - `AxisAlignedLine ` the first line
471
- - **line2 ** - `AxisAlignedLine ` the second line
472
- - **Return Value ** - `bool, numeric or None ` touching, mtv against 1
473
-
474
- Determine if the two lines are touching, and then returns the
475
- minimum translation vector to move line 1 along axis. If the result
476
- is negative, it means line 1 should be moved in the opposite direction
477
- of the axis by the magnitude of the result.
478
-
479
- Returns `true, None ` if the lines are touching.
480
-
481
- .. note ::
482
-
483
- Ensure your program correctly handles `true, None `
484
-
485
- .. staticmethod :: AxisAlignedLine.contains_point(line, point)
486
-
487
- - **line ** - `AxisAlignedLine ` the line
488
- - **point ** - `numeric ` the point
489
- - **Return Value ** - `bool, bool ` if point is contained, if the point is an edge
490
-
491
- Determine if the line contains the specified point, which is assumed
492
- to be defined the same way as min and max.
493
-
494
- .. tip ::
495
-
496
- It is not possible for both returned booleans to be `True `.
497
-
498
-
499
- Axis-Aligned Line (autogen)
500
- ---------------------------
501
-
502
400
.. autoclass :: pygorithm.geometry.axisall.AxisAlignedLine
503
401
:members:
504
402
0 commit comments