From: Matthias B. <ba...@ir...> - 2004-08-03 07:36:05
|
Hi, I'm just in the process of restructuring the Space class. The first step was to derive it from GeomObject as ODE considers spaces to be geoms as well. This is already in cvs. As a second step I'd like to split the Space class in its individual classes as there are already three of them in ODE: SimpleSpace, HashSpace and QuadTreeSpace. However, before doing so I thought I'd better ask what you think of it. Are you in favor of this change or do you think we should stick to one Space class and pass the type as argument (as it is the case right now)? If we'll have individual classes, what class names would you prefer? Should "Space" be the abstract base class or an alias for the SimpleSpace class to remain at least a bit of compatibility to the previous version? Or should "Space" be a factory function that still works like before and returns the appropriate space class..... (hm, this just occurred to me while typing the mail and now I'm indeed in favor of that solution as it remains fully compatible with the previous version. Any objections? :) ) - Matthias - |
From: Timothy S. <ti...@st...> - 2004-08-04 15:46:56
|
On Tue, 2004-08-03 at 09:36, Matthias Baas wrote: > As a second step I'd like to split the Space class in its individual=20 > classes as there are already three of them in ODE: SimpleSpace,=20 > HashSpace and QuadTreeSpace. However, before doing so I thought I'd=20 > better ask what you think of it. Are you in favor of this change or do=20 > you think we should stick to one Space class and pass the type as=20 > argument (as it is the case right now)? I'm in favour of splitting them into separate classes. > If we'll have individual classes, what class names would you prefer?=20 SimpleSpace, HashSpace and QuadTreeSpace are fine. > Should "Space" be the abstract base class or an alias for the=20 > SimpleSpace class to remain at least a bit of compatibility to the=20 > previous version? Or should "Space" be a factory function that still=20 > works like before and returns the appropriate space class..... I agree that having Space as a factory function is a good idea. Maybe "SpaceBase" could be the abstract base class for the spaces? --=20 Timothy Stranex <ti...@st...> |
From: Matthias B. <ba...@ir...> - 2004-08-05 16:09:52
|
Hi, I have implemented the previously mentioned space restructuring (SpaceBase, SimpleSpace, HashSpace, QuadTreeSpace classes and a factory function Space). Now there's a problem with the XODE reader because it's assuming ode.Space is a class and not a function (e.g. when using isinstance()). The unit test produces exceptions like this: File "C:\PROGRA~1\PROGRA~1\Python23\Lib\site-packages\xode\geom.py", line 20, in __init__ self._space = self.getFirstAncestor(ode.Space).getODEObject() File "C:\PROGRA~1\PROGRA~1\Python23\Lib\site-packages\xode\node.py", line 209, in getFirstAncestor if (isinstance(parent.getODEObject(), type)): TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types So is this a real problem or can it be easily fixed? (you could use SpaceBase instead of Space. However, I don't know if you have to be able to create instances of the class you're using. You can't create instances from SpaceBase) By the way, what kind of Space will the XODE reader create? By browsing through the XODE spec it seems there's no way to specify which space should be used...(or did I miss something?). - Matthias - |
From: Timothy S. <ti...@st...> - 2004-08-05 19:37:15
|
On Thu, 2004-08-05 at 18:10, Matthias Baas wrote: > So is this a real problem or can it be easily fixed? (you could use=20 > SpaceBase instead of Space. However, I don't know if you have to be able=20 > to create instances of the class you're using. You can't create=20 > instances from SpaceBase) It should be a trivial fix. The Space class in parser.py just needs to be updated to use one of the specific Space classes and the other classes need to use SpaceBase instead of Space as an argument to getFirstAncestor(). > By the way, what kind of Space will the XODE reader create? By browsing=20 > through the XODE spec it seems there's no way to specify which space=20 > should be used...(or did I miss something?). I can think of two options: create an XODE extension that allows the user to set the space class; or, allow the user to pass an argument to the XODE parser indicating which space class to use. Maybe they could both be implemented by using the space class specified by a parser parameter unless it is overridden by the extension. Any thoughs? --=20 Timothy Stranex <ti...@st...> |
From: Matthias B. <ba...@ir...> - 2004-08-05 20:54:17
|
Timothy Stranex wrote: > It should be a trivial fix. The Space class in parser.py just needs to > be updated to use one of the specific Space classes and the other > classes need to use SpaceBase instead of Space as an argument to > getFirstAncestor(). ok. I've just commited my changes, so it's available in cvs now. >>By the way, what kind of Space will the XODE reader create? By browsing >>through the XODE spec it seems there's no way to specify which space >>should be used...(or did I miss something?). > > I can think of two options: create an XODE extension that allows the > user to set the space class; or, allow the user to pass an argument to > the XODE parser indicating which space class to use. Maybe they could > both be implemented by using the space class specified by a parser > parameter unless it is overridden by the extension. Any thoughs? Do I understand that correctly that in the first option the space type is encoded directly in the XODE file whereas in the second option it's in the application code? I would say both options can be useful. You certainly want to be able to store the space type in the file, but on the other hand it might also be useful to override these settings. (Actually, I wonder why this isn't mentioned in the XODE spec at all. Did they just forget that there are several space types or do they think it's a detail that the application has to deal with?) - Matthias - |
From: Timothy S. <ti...@st...> - 2004-08-06 13:40:53
|
On Thu, 2004-08-05 at 22:54, Matthias Baas wrote: > Do I understand that correctly that in the first option the space type=20 > is encoded directly in the XODE file whereas in the second option it's=20 > in the application code? Affirmative. > (Actually, I wonder why this isn't mentioned in the XODE spec at all.=20 > Did they just forget that there are several space types or do they think=20 > it's a detail that the application has to deal with?) I have sent a message to William Denniss (the author of XODE) about this. I suggested either adding space class selection export to a future XODE release or adding an extension that looks something like this: <ext name=3D"space-class"> # Any one of the following options: # 1. <simple/> # 2. <hash/> # 3. <quadtree centerx=3D"" centery=3D"" centerz=3D"" extentsx=3D"" extentsy=3D"" extentsz=3D"" depth=3D""/> </ext> --=20 Timothy Stranex <ti...@st...> |
From: Matthias B. <ba...@ir...> - 2004-08-24 13:09:17
|
Timothy Stranex wrote: > I have sent a message to William Denniss (the author of XODE) about > this. I suggested either adding space class selection export to a future > XODE release or adding an extension that looks something like this: > [...] Did you get any reply? - Matthias - |
From: Timothy S. <ti...@st...> - 2004-08-24 14:38:54
|
On Tue, 2004-08-24 at 15:08, Matthias Baas wrote: > Timothy Stranex wrote: > > I have sent a message to William Denniss (the author of XODE) about > > this. >=20 > Did you get any reply? I got one reply but nothing back from my reply to that... One big problem with creating an XODE extension is that the extension tag comes at the end of the space element making it impossible to create the Space instance before the bodies and geoms. It would mean either moving to a DOM parser or implementing something similar. I think we should defer support for Space classes specified in the XODE file to a later release. --=20 Timothy Stranex <ti...@st...> |