Skip to content

Commit

Permalink
trying to fix CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielJMS committed Sep 27, 2023
1 parent cd87c7f commit 1d5a2df
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools", "Cython", "numpy"]
requires = ["setuptools", "Cython>3", "numpy"]
build-backend = "setuptools.build_meta"
8 changes: 6 additions & 2 deletions tests/edges/test_arc3d.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import math
import os
import unittest
from itertools import product

Expand All @@ -8,6 +9,9 @@
from volmdlr.models.curves import circle3d


folder = os.path.join(os.path.dirname(os.path.realpath(__file__)), "arc_objects")


class TestArc3D(unittest.TestCase):
list_points = circle3d.discretization_points(number_points=8)
arc3d = edges.Arc3D(circle3d, start=volmdlr.Point3D(0.5773502691896258, 0.5773502691896258, 0.5773502691896258),
Expand Down Expand Up @@ -82,7 +86,7 @@ def test_abscissa(self):
for abscissa, expected_abscissa in zip(abscissas, expected_abscissa):
self.assertAlmostEqual(abscissa, expected_abscissa)

arc = edges.Arc3D.load_from_file("edges/arc_objects/arc_abscissa_bug.json")
arc = edges.Arc3D.load_from_file(os.path.join(folder, "arc_abscissa_bug.json"))
point = volmdlr.Point3D(0.6002208894332702, -0.637646466964, 0.006570128575852758)
abscissa = arc.abscissa(point)
self.assertAlmostEqual(abscissa, 0.019320794819579237)
Expand Down Expand Up @@ -252,7 +256,7 @@ def test_point_distance(self):
self.assertEqual(arc.point_distance(point4), math.sqrt(2))

point = volmdlr.Point3D(0.33525, -0.51106, 0.639935)
arc = dessia_common.core.DessiaObject.load_from_file('edges/arc_objects/arc3d_test_point_distance.json')
arc = dessia_common.core.DessiaObject.load_from_file(os.path.join(folder, "arc3d_test_point_distance.json"))
self.assertAlmostEqual(arc.point_distance(point), 0.0021097842575404403)

def test_arc_intersections(self):
Expand Down
36 changes: 36 additions & 0 deletions volmdlr/core_compiled.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,22 @@ cdef class Point2D(Vector2D):
self.y = y
self.name = name

def __setitem__(self, key, item):
if key == 0:
self.x = item
elif key == 1:
self.y = item
else:
raise IndexError

def __getitem__(self, key):
if key == 0:
return self.x
elif key == 1:
return self.y
else:
raise IndexError

def __add__(self, other_vector):
return Point2D(*c_add_2d(self.x, self.y, other_vector.x, other_vector.y))

Expand Down Expand Up @@ -1839,6 +1855,26 @@ cdef class Point3D(Vector3D):
self.z = z
self.name = name

def __setitem__(self, key, item):
if key == 0:
self.x = item
elif key == 1:
self.y = item
elif key == 2:
self.z = item
else:
raise IndexError

def __getitem__(self, key):
if key == 0:
return self.x
elif key == 1:
return self.y
elif key == 2:
return self.z
else:
raise IndexError

def __add__(self, other_vector):
return Point3D(*c_add_3d(self.x, self.y, self.z, other_vector.x, other_vector.y, other_vector.z))

Expand Down

0 comments on commit 1d5a2df

Please sign in to comment.