From: Bruce S. <Bru...@nc...> - 2008-03-18 18:13:32
|
Okay, this is specific enough to consider. My guess is that many of these checks would be fabulously expensive and difficult, and much better done by the programmer dealing with particular cases, who knows the specifics of the situation. The possible exception might be your function objectsAt(x,y,z), though I doubt it. The renderer "knows" much less than you imagine it knowing, in order to do 3D graphics in real time. VPython isn't a solid-modeling package nor a ray-tracer. Bruce Sherwood Hans-Joachim Gurt wrote: >>As you know, none of these kinds of checks are currently built into >>Visual. One of the problems is that what you're asking for is not >>very well defined. > > >>>I would like to >>>* check if objects in a scene overlap, >> >>Overlap in the 2D projection on the screen, or overlap in 3D? >> >>>* check if an area in space is empty, >> >>Presumably you mean volume? > > > I meant volume, and overlap in 3D. > > >>>* get a list of objects that occupy a given point or area in space, >> >>Area on the 2D screen? Or volume in the 3D space? > > > I was thinking of a function like objectsAt(0,0,0) that would > return a list of all objects that occupy that point in space. > > > >>>* get the distance between objects >> >>"Distance between objects" is an ill-defined term. >>Shortest distance between any two points in the two objects? > > > The idea was to check if two objects are about to collide. > I realize that this gets more and more difficult with the form > and the velocities of the objects. So probably too hard... > > > >>>E.g. in the demo "bouncing ball", I would like to check >>>if the ball touches/overlaps the floor-object, as opposed >>>to checking a fixed y-value for reversing the motion. >> >>Note that in "stars.py" there is such a check, a check to see >>whether the center-to-center distance of two stars is less than >>the sum of the two radii of the two stars. > > > Ok, that is another example for the user doing the 'housekeeping'. > I was thinking that the infos about all the objects in the scene > must be available to the renderer, and could somehow be queried. > > > >>>The empty-check would be useful for automatic placing of labels >>>(e.g. by varying the offsets if an area is occupied), >>>so that they don't overlap curves/objects/other labels. >> >>maybe you're most interested in area on the 2D projection. > > > I had the gcurve-example in mind. There the problem is reduced to 2D. > For placing readable, non-overlapping labels, checking their area on > the 2D projection on the screen would be enough (if that can be done > more easily). > > But if you want, for example, fill a volume with objects such as > in the randombox-demo, (but also with other things than just boxes) > and check that those objects don't overlap, a 3D-check would be needed. > > > Regards, > HaJo Gurt |