|
98 | 98 | | :sl:`x and y coordinates of the center of the circle` |
99 | 99 | | :sg:`center -> (float, float)` |
100 | 100 |
|
101 | | - It's a tuple containing the circle's `x` and `y` coordinates representing its center. |
| 101 | + A tuple containing the circle's `x` and `y` coordinates representing its center. |
102 | 102 | Reassigning it moves the circle to the new position. |
103 | 103 |
|
104 | 104 | .. versionadded:: 2.4.0 |
|
147 | 147 | | :sl:`top coordinate of the circle` |
148 | 148 | | :sg:`top -> (float, float)` |
149 | 149 |
|
150 | | - It's a tuple containing the `x` and `y` coordinates that represent the top |
| 150 | + A tuple containing the `x` and `y` coordinates that represent the top |
151 | 151 | of the circle. |
152 | 152 | Reassigning it moves the circle to the new position. The radius will not be affected. |
153 | 153 |
|
|
160 | 160 | | :sl:`bottom coordinate of the circle` |
161 | 161 | | :sg:`bottom -> (float, float)` |
162 | 162 |
|
163 | | - It's a tuple containing the `x` and `y` coordinates that represent the bottom |
| 163 | + A tuple containing the `x` and `y` coordinates that represent the bottom |
164 | 164 | of the circle. |
165 | 165 | Reassigning it moves the circle to the new position. The radius will not be affected. |
166 | 166 |
|
|
173 | 173 | | :sl:`left coordinate of the circle` |
174 | 174 | | :sg:`left -> (float, float)` |
175 | 175 |
|
176 | | - It's a tuple containing the `x` and `y` coordinates that represent the left |
| 176 | + A tuple containing the `x` and `y` coordinates that represent the left |
177 | 177 | of the circle. |
178 | 178 | Reassigning it moves the circle to the new position. The radius will not be affected. |
179 | 179 |
|
|
186 | 186 | | :sl:`right coordinate of the circle` |
187 | 187 | | :sg:`right -> (float, float)` |
188 | 188 |
|
189 | | - It's a tuple containing the `x` and `y` coordinates that represent the right |
| 189 | + A tuple containing the `x` and `y` coordinates that represent the right |
190 | 190 | of the circle. |
191 | 191 | Reassigning it moves the circle to the new position. The radius will not be affected. |
192 | 192 |
|
|
574 | 574 | | :sl:`the first point of the line` |
575 | 575 | | :sg:`a -> (float, float)` |
576 | 576 |
|
577 | | - It's a tuple containing the `ax` and `ay` attributes representing the line's first point. |
| 577 | + A tuple containing the `ax` and `ay` attributes representing the line's first point. |
578 | 578 | It can be reassigned to move the `Line`. If reassigned the `ax` and `ay` attributes |
579 | 579 | will be changed to produce a `Line` with matching first point position. |
580 | 580 | The `bx` and `by` attributes will not be affected. |
|
588 | 588 | | :sl:`the second point of the line` |
589 | 589 | | :sg:`b -> (float, float)` |
590 | 590 |
|
591 | | - It's a tuple containing `bx` and `by` attributes representing the line's second point. |
| 591 | + A tuple containing `bx` and `by` attributes representing the line's second point. |
592 | 592 | It can be reassigned to move the `Line`. If reassigned the `bx` and `by` attributes |
593 | 593 | will be changed to produce a `Line` with matching second point position. |
594 | 594 | The `ax` and `ay` attributes will not be affected. |
|
597 | 597 |
|
598 | 598 | .. ## Line.b ## |
599 | 599 |
|
| 600 | + .. attribute:: length |
| 601 | + |
| 602 | + | :sl:`the length of the line` |
| 603 | + | :sg:`length -> float` |
| 604 | +
|
| 605 | + The length of the line. Calculated using the `sqrt((bx-ax)**2 + (by-ay)**2)` formula. |
| 606 | + This attribute is read-only, it cannot be reassigned. To change the line's length |
| 607 | + use the `scale` method or change its `a` or `b` attributes. |
| 608 | + |
| 609 | + .. versionadded:: 2.5.3 |
| 610 | + |
| 611 | + .. ## Line.length ## |
| 612 | +
|
600 | 613 | **Line Methods** |
601 | 614 |
|
602 | 615 | ---- |
|
611 | 624 | .. versionadded:: 2.5.2 |
612 | 625 |
|
613 | 626 | .. ## Line.copy ## |
| 627 | +
|
| 628 | + .. method:: move |
| 629 | + |
| 630 | + | :sl:`moves the line by a given amount` |
| 631 | + | :sg:`move((x, y)) -> Line` |
| 632 | + | :sg:`move(x, y) -> Line` |
| 633 | +
|
| 634 | + Returns a new `Line` that is moved by the given offset. The original `Line` is |
| 635 | + not modified. |
| 636 | + |
| 637 | + This method is equivalent to the following code: |
| 638 | + |
| 639 | + .. code-block:: python |
| 640 | +
|
| 641 | + Line(line.ax + x, line.ay + y, line.bx + x, line.by + y) |
| 642 | +
|
| 643 | + .. versionadded:: 2.5.3 |
| 644 | + |
| 645 | + .. ## Line.move ## |
| 646 | +
|
| 647 | + .. method:: move_ip |
| 648 | + |
| 649 | + | :sl:`moves the line by a given amount` |
| 650 | + | :sg:`move_ip((x, y)) -> None` |
| 651 | + | :sg:`move_ip(x, y) -> None` |
| 652 | +
|
| 653 | + Moves the `Line` by the given offset. The original `Line` is modified. Always returns |
| 654 | + `None`. |
| 655 | + |
| 656 | + This method is equivalent to the following code: |
| 657 | + |
| 658 | + .. code-block:: python |
| 659 | +
|
| 660 | + line.ax += x |
| 661 | + line.ay += y |
| 662 | + line.bx += x |
| 663 | + line.by += y |
| 664 | +
|
| 665 | + .. versionadded:: 2.5.3 |
| 666 | + |
| 667 | + .. ## Line.move_ip ## |
| 668 | +
|
| 669 | + .. method:: update |
| 670 | + |
| 671 | + | :sl:`updates the line's attributes` |
| 672 | + | :sg:`update((ax, ay), (bx, by)) -> None` |
| 673 | + | :sg:`update(ax, ay, bx, by) -> None` |
| 674 | + | :sg:`update(line) -> None` |
| 675 | +
|
| 676 | + Updates the `Line`'s attributes. The original `Line` is modified. Always returns `None`. |
| 677 | + |
| 678 | + This method is equivalent to the following code: |
| 679 | + |
| 680 | + .. code-block:: python |
| 681 | +
|
| 682 | + line.ax = ax |
| 683 | + line.ay = ay |
| 684 | + line.bx = bx |
| 685 | + line.by = by |
| 686 | +
|
| 687 | + .. versionadded:: 2.5.3 |
| 688 | + |
| 689 | + .. ## Line.update ## |
| 690 | +
|
| 691 | + .. method:: scale |
| 692 | + |
| 693 | + | :sl:`scales the line by the given factor from the given origin` |
| 694 | + | :sg:`scale(factor, origin) -> Line` |
| 695 | + | :sg:`scale(factor_and_origin) -> Line` |
| 696 | +
|
| 697 | + Returns a new `Line` which is scaled by the given factor from the specified origin with 0.0 being |
| 698 | + the starting point, 0.5 being the center and 1.0 being the end point. |
| 699 | + The original `Line` is not modified. |
| 700 | + |
| 701 | + .. versionadded:: 2.5.3 |
| 702 | + |
| 703 | + .. ## Line.scale ## |
| 704 | +
|
| 705 | + .. method:: scale_ip |
| 706 | + |
| 707 | + | :sl:`scales the line by the given factor from the given origin in place` |
| 708 | + | :sg:`scale_ip(factor, origin) -> None` |
| 709 | + | :sg:`scale_ip(factor_and_origin) -> None` |
| 710 | +
|
| 711 | + Scales the `Line` by the given factor from the specified origin with 0.0 being |
| 712 | + the starting point, 0.5 being the center and 1.0 being the end point. |
| 713 | + The original `Line` is modified. |
| 714 | + Always returns `None`. |
| 715 | + |
| 716 | + .. versionadded:: 2.5.3 |
| 717 | + |
| 718 | + .. ## Line.scale_ip ## |
| 719 | +
|
| 720 | + .. method:: flip_ab |
| 721 | + |
| 722 | + | :sl:`flips the line a and b points` |
| 723 | + | :sg:`flip_ab() -> Line` |
| 724 | +
|
| 725 | + Returns a new `Line` that has the `a` and `b` points flipped. |
| 726 | + The original `Line` is not modified. |
| 727 | + |
| 728 | + .. versionadded:: 2.5.3 |
| 729 | + |
| 730 | + .. ## Line.flip_ab ## |
| 731 | +
|
| 732 | + .. method:: flip_ab_ip |
| 733 | + |
| 734 | + | :sl:`flips the line a and b points, in place` |
| 735 | + | :sg:`flip_ab_ip() -> None` |
| 736 | +
|
| 737 | + Flips the `Line`'s `a` and `b` points. The original `Line` is modified. |
| 738 | + Always returns `None`. |
| 739 | + |
| 740 | + .. versionadded:: 2.5.3 |
| 741 | + |
| 742 | + .. ## Line.flip_ab_ip ## |
0 commit comments