@@ -154,3 +154,33 @@ def test_surface_eval():
154154 res = u [:, None , None ] * u_vec + v [None , :, None ] * v_vec
155155
156156 assert np .all (res == arr_out )
157+
158+
159+ @pytest .mark .parametrize (
160+ "line,ndim" ,
161+ (
162+ (Geom2d_Line (gp_Pnt2d (0.0 , 0.0 ), gp_Dir2d (1.0 , 0.15 )), 2 ),
163+ (Geom_Line (gp_Pnt (0.0 , 0.0 , 0.0 ), gp_Dir (1.0 , 0.15 , 0.0 )), 3 ),
164+ ),
165+ )
166+ def test_curve_derivative_eval (line , ndim ):
167+ u = np .arange (5 , dtype = float )
168+ vectors = line .eval_derivative_numpy_array (u , 1 )
169+
170+ gp_line = line .Lin () if isinstance (line , Geom_Line ) else line .Lin2d ()
171+
172+ direction = np .array ([gp_line .Direction ().Coord (i + 1 ) for i in range (ndim )])
173+ assert np .all (vectors == direction )
174+
175+
176+ def test_surface_derivative_eval ():
177+ n_vec = np .array ([1.0 , 0.15 , 0.0 ])
178+ u = np .arange (5 , dtype = float )
179+ v = np .arange (6 , dtype = float )
180+
181+ plane = Geom_Plane (gp_Pnt (0.0 , 0.0 , 0.0 ), gp_Dir (* n_vec ))
182+ uv = np .dstack (np .meshgrid (u , v , indexing = "ij" )).reshape (- 1 , 2 )
183+ arr_out = plane .eval_derivative_numpy_array (uv , 0 , 1 ).reshape (len (u ), len (v ), - 1 )
184+ assert np .all (arr_out @ n_vec == 0.0 )
185+ arr_out = plane .eval_derivative_numpy_array (uv , 1 , 0 ).reshape (len (u ), len (v ), - 1 )
186+ assert np .all (arr_out @ n_vec == 0.0 )
0 commit comments