Hi ! For a robotics simulation, I need to calculate the distance that an ultrasound sensor would measure (=> distance to the closest obstacle).
Here's the code I'm using to do so (knowing that what's in "self.shapes" has been parsed from an SVG file and is mainly ellipses): def RayDistance(self, x, y, headingAngle): > > ray = Ray(Point(x,y), angle=headingAngle) >> > minDist = None > > for shape in self.shapes: > > intersections = ray.intersection(shape) > > for intersection in intersections: > > distance = intersection.distance(ray.source) > > print "Shape {} ; Intersection {} ; Distance {}".format(shape, >> intersection, distance) > > if minDist == None: > > minDist = distance > > elif distance < minDist: > > minDist = distance > > return minDist > > Doing this is extremely slow, even with just 3 shapes. If I go up to 200 shapes, I only get about 1 frame per second. And I only detectect a collision from time to time (especially if I slightly change my heading angle while facing a same obstacle). For instance, I'm using Qt for the visualisation and my "headingAngle" is in radians and ccw (0 being horizantal, headed to the positive x), my coordinates are floats and using the graphical reference system (=> positive Xs to the "right" and positive Ys to the bottom) It's my first experience with Sympy, so I may just be using the wrong tools for what I'm trying to do. Thank you in advance! -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.