Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/shapepy/bool2d/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def rotate(self, angle: Angle) -> SubSetR2:
-----------
>>> from shapepy import Primitive
>>> circle = Primitive.circle()
>>> circle.rotate(Angle.degrees(90))
>>> circle.rotate(degrees(90))

"""
raise NotImplementedError
Expand Down
2 changes: 1 addition & 1 deletion src/shapepy/geometry/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def rotate(self, angle: Angle) -> IGeometricCurve:
-----------
>>> from shapepy import Primitive
>>> circle = Primitive.circle()
>>> circle.rotate(Angle.degrees(90))
>>> circle.rotate(degrees(90))

"""
raise NotImplementedError
Expand Down
6 changes: 3 additions & 3 deletions src/shapepy/geometry/integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ..analytic.tools import find_minimum
from ..common import derivate
from ..loggers import debug
from ..scalar.angle import Angle
from ..scalar.angle import arg
from ..scalar.quadrature import AdaptativeIntegrator, IntegratorFactory
from ..scalar.reals import Math
from ..tools import Is, To
Expand Down Expand Up @@ -90,8 +90,8 @@ def lebesgue_density_jordan(
deltapj = segmentj(1, 1)
innerval = inner(deltapi, deltapj)
crossval = cross(deltapi, deltapj)
angle = Angle.arg(-innerval, -crossval)
return float(angle) / Math.tau
angle = arg(-innerval, -crossval)
return angle.turns % 1

direct = IntegratorFactory.closed_newton_cotes(3)
integrator = AdaptativeIntegrator(direct, 1e-6)
Expand Down
8 changes: 4 additions & 4 deletions src/shapepy/geometry/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Tuple, Union

from ..loggers import debug
from ..scalar.angle import Angle
from ..scalar.angle import Angle, arg, degrees
from ..scalar.reals import Math, Real
from ..tools import Is, To

Expand All @@ -32,7 +32,7 @@ def polar(radius: Real, angle: Angle) -> Point2D:
Creates a Point with polar coordinates
"""
radius = To.real(radius)
angle = Angle.degrees(0) if radius == 0 else To.angle(angle)
angle = degrees(0) if radius == 0 else To.angle(angle)
return Point2D(None, None, radius, angle)


Expand Down Expand Up @@ -83,7 +83,7 @@ def radius(self) -> Real:
def angle(self) -> Angle:
"""The angle the point (x, y) forms with respect to the horizontal"""
if self.__angle is None:
self.__angle = Angle.arg(self.__xcoord, self.__ycoord)
self.__angle = arg(self.__xcoord, self.__ycoord)
return self.__angle

def __copy__(self) -> Point2D:
Expand Down Expand Up @@ -117,7 +117,7 @@ def __neg__(self) -> Point2D:
-self.xcoord,
-self.ycoord,
self.radius,
self.angle + Angle.degrees(180),
self.angle + degrees(180),
)

def __pos__(self) -> Point2D:
Expand Down
5 changes: 4 additions & 1 deletion src/shapepy/scalar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
defines the class Angle to handle conversions between radians and degrees,
defines the methods of numerical integration (quadrature)"""

from .angle import Angle
from ..tools import To
from .angle import Angle, to_angle
from .reals import Math, Rational, Real

To.angle = to_angle
Loading
Loading