-
-
Notifications
You must be signed in to change notification settings - Fork 400
Closed
Description
I currently use OCC version (7, 4, 0, '-rc1') and tried to create arcs of an ellipse for three normals:
- (0,0,1) rotated by 30° around x-yaxis
- (0,0,1) rotated by 45° around x-yaxis
- (0,0,1) rotated by 46° around x-yaxis
from OCC.Core.gp import gp_Elips, gp_Ax2, gp_Pnt, gp_Dir
from OCC.Core.GC import GC_MakeArcOfEllipse
from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeEdge
from math import pi, sin, cos
import numpy as np
def rad(deg):
return deg /180.0 * pi
def Rx(angle, t):
angle = rad(angle)
mat = np.array([
[1, 0, 0 ],
[0, cos(angle), -sin(angle)],
[0, sin(angle), cos(angle)]
])
return tuple(np.matmul(mat, t))
def sample(d):
pnt = gp_Pnt(0.0, 0.0, 0.0)
dir_ = gp_Dir(*d)
ellipse_gp = gp_Elips(gp_Ax2(pnt, dir_), 20, 10)
ellipse = BRepBuilderAPI_MakeEdge(ellipse_gp).Edge()
ellipse_geom = GC_MakeArcOfEllipse(ellipse_gp, 0.0, pi/2, True).Value()
return BRepBuilderAPI_MakeEdge(ellipse_geom).Edge()
sample(Rx(30, (0,0,1)))
sample(Rx(45, (0,0,1)))
sample(Rx(46, (0,0,1)))The result is surprising (magenta=30°. black=45°, cyan=46°):
Why does the arc flip to the other side when I move from 45° to 46°?
Metadata
Metadata
Assignees
Labels
No labels
