[x3d-public] Behavior of X3D's DOM integration

Kristian Sons kristian.sons at dfki.de
Thu Apr 16 23:16:33 PDT 2015


Am 16.04.2015 um 15:03 schrieb Behr, Johannes:
>> <Group>
>>     <Shape DEF="A">
>>       <Sphere>
>>       <Appearance DEF="red">
>>         <Material diffuseColor='1.0 0.0 0.0'/>
>>       </Appearance>
>>     </Shape>
>>     <Shape DEF="B">
>>       <Box/>
>>       <Appearance USE="red"/>
>>     </Shape>
>> </Group>
>   
>> On 16 Apr 2015, at 10:11, Kristian Sons <kristian.sons at dfki.de> wrote:
>>
>> Hi Johannes,
>>>>> Using Johannes approach, one would circumvent this. On the other hand this would result in some magic transforming the DOM at other places if the user deletes or adds a node. I would find this very counterintuitive.
>>> For me DEF/USE is really just a serialisation construct to map the graph to a tree and therefore two pointer to the same node which should behaviour exactly the same. According to the spec the node is the same. Deep-copies are done with Proto-instances. Therefore this should work:
>>>
>>> 1) Create to shapes (A,B) which share the material
>>> 2) Delete one shape (A)
>>> 3) (B) should still work with the given material in the setup state
>> I absolutely see your point, this is how X3D works. However with your example above in the DOM starting from this:
>>
>> <Group>
>>     <Shape DEF="A">
>>       <Sphere>
>>       <Appearance DEF="red">
>>         <Material diffuseColor='1.0 0.0 0.0'/>
>>       </Appearance>
>>     </Shape>
>>     <Shape DEF="B">
>>       <Box/>
>>       <Appearance USE="red"/>
>>     </Shape>
>> </Group>
> If you interpret the DOM traversal as scene serialisation:
>
> <Group>
>     <Shape DEF="B">
>       <Box/>
>       <Appearance DEF="red">
>         <Material diffuseColor='1.0 0.0 0.0'/>
>       </Appearance>
>     </Shape>
> </Group>

I would find it very strange, if modifying the DOM in one branch would 
end up in (system-triggered) mutations in some other branch. I am not 
aware of any occasion that this would happen in HTML or SVG.

In particular this is very strange:

// Removing A
document.querySelector("Shape[DEF=A]").remove();

// Assert A has been removed
console.assert(document.querySelector("Shape[DEF=A]") == null)
 >  Assertion failed:

WRT this behavior, I would agree to Max and Len and prefer dangling 
references even if they are not X3D-like but have a more SVG/HTML-like 
behavior.

However, I think this simple example shows that a X3D DOM-integration is 
not as straight-forward as it seems to be at first sight.

Best,
   Kristian

>
> This is exactly what aopt does if you delete A.
>
> aopt -i in.x3d -d “A” -x out.x3d
>
> best regards
> johannes
>
>> How would the DOM look like after deleting Shape#A?
>>
>> Best,
>>   Kristian
>>
>> -- 
>> _______________________________________________________________________________
>>
>> Kristian Sons
>> Deutsches Forschungszentrum für Künstliche Intelligenz GmbH, DFKI
>> Agenten und Simulierte Realität
>> Campus, Geb. D 3 2, Raum 0.77
>> 66123 Saarbrücken, Germany
>>
>> Phone: +49 681 85775-3833
>> Phone: +49 681 302-3833
>> Fax:   +49 681 85775–2235
>> kristian.sons at dfki.de
>> http://www.xml3d.org
>>
>> Geschäftsführung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender)
>> Dr. Walter Olthoff
>>
>> Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
>> Amtsgericht Kaiserslautern, HRB 2313
>> _______________________________________________________________________________
>>
> ---
> Dr. Johannes Behr
> Visual Computing System Technologies
> Fraunhofer IGD
> Fraunhoferstr. 5  |  64283 Darmstadt  |  Germany
> Tel +49 6151 155-510  |  Fax +49 6151 155-196
> johannes.behr at igd.fraunhofer.de  |  www.igd.fraunhofer.de/vcst
>


-- 
_______________________________________________________________________________

Kristian Sons
Deutsches Forschungszentrum für Künstliche Intelligenz GmbH, DFKI
Agenten und Simulierte Realität
Campus, Geb. D 3 2, Raum 0.77
66123 Saarbrücken, Germany

Phone: +49 681 85775-3833
Phone: +49 681 302-3833
Fax:   +49 681 85775–2235
kristian.sons at dfki.de
http://www.xml3d.org

Geschäftsführung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender)
Dr. Walter Olthoff

Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
_______________________________________________________________________________




More information about the x3d-public mailing list