def draw_3d_ellipse(self, n_cycles):
     a = 1
     b = 2
     x = self.x_range['max']
     z = self.x_range['min']
     ls = np.linspace(0, 2 * np.pi, num=50)
     for n in range(n_cycles):
         for i in ls:
             e1 = Ellipse(SympyPoint(0, 0), a, b)
             p = e1.arbitrary_point()
             #  print('x='+str(cos(i)) + '  y= '+str(2*sin(i)))
             x = cos(i) / 2
             z = 3 * sin(i) / 10
             try:
                 self.service_caller(x=x, y=0.1+n*0.1, z=z, qx=0, qy=0, qz=0, qw=1, \
                     execution_time=0.01, interpolation_type=self.interpolation_type)
             except rospy.ServiceException as exc:
                 pass
     return True
Example #2
0
# circle
cx, cy = (10, 20)
r = 15
# ellipse
ecx, ecy = (20, 20)
a = 20  # h_radius
b = 10  # v_radius

c = Circle(Point(cx, cy), r)
e = Ellipse(Point(ecx, ecy), a, b)

if USE_SYMPY_INTERSECTION:
    i = e.intersection(c)

c_eq = c.arbitrary_point()
e_eq = e.arbitrary_point()

if VISUALISE or SAVE_PLOT:
    import matplotlib.pyplot as plt
    from math import sin, cos, radians as rad

    fig = plt.figure()
    ax = plt.subplot()
    ax.set_aspect(1.0)
    plt.axis([0, 40, 40, 0])
    ax.set_title("Ellipse intersects a unit circle", size=22)
    ax.set_xlabel("x", size=14)
    ax.set_ylabel("y", size=14)

    for t in np.arange(rad(0), rad(360), rad(2)):
        pcx, pcy = eval(str(c_eq.x)), eval(str(c_eq.y))