-----------------------------------------------------------------------
-- An example of Actor Prolog program.                               --
-- (c) 2012 IRE RAS Alexei A. Morozov                                --
-----------------------------------------------------------------------
import .. from "morozov/Java3D";
-----------------------------------------------------------------------
interface 'Main' (specialized 'Canvas3D'):
--
internal:
--
set     : 'FindAllNodes';
--
data    : 'MyDatabase';
--
[
]
-----------------------------------------------------------------------
class 'Main' (specialized 'Canvas3D'):
--
internal:
--
set     = ('FindAll',
                world=data);
--
data    = ('MyDatabase');
--
[
goal:-!,
        data ? load("jar:data/cortex1.db"),
        data ? load("jar:data/cortex2.db"),
        NodeList== set ? get_node,
        Bounds== 'BoundingSphere'({
                center: p(0.0,0.0,0.0),
                radius: 100.0
                }),
        show([
                'TransformGroup'({
                        allowTransformWrite: 'yes',
                        allowTransformRead: 'yes',
                        transform3D: 'Transform3D'({
                                translation: [0,0,-1]
                                }),
                        branches: [
                                'TransformGroup'({
                                        transform3D: 'Transform3D'({
                                                scale: 7,
                                                rotX: -(?pi()/2),
                                                rotZ: ?pi()*3/4
                                                }),
                                        branches: NodeList
                                        }),
                                'MouseRotate'({
                                        schedulingBounds: Bounds
                                        }),
                                'MouseZoom'({
                                        schedulingBounds: Bounds
                                        }),
                                'MouseWheelZoom'({
                                        schedulingBounds: Bounds
                                        })
                                ]
                        }),
                'ModelClip'({
                        1: [0.0,0.0,1.0,0.0],
                        influencingBounds: Bounds
                        })
                ]).
]
-----------------------------------------------------------------------
interface 'FindAllNodes' (specialized 'FindAll'):
[
PREDICATES:
--
imperative:
--
get_node = NodeList;
]
-----------------------------------------------------------------------
class 'MyDatabase' (specialized 'Database'):
[
DOMAINS:
--
Target  = v(Numerical,Numerical,Numerical,Color).
--
PREDICATES:
--
nondeterm:
--
get_node = TransformGroup;
--
CLAUSES:
--
get_node = 'TransformGroup'({
                transform3D: 'Transform3D'({
                        translation: [X,Y,Z]
                        }),
                branches: [
                        'Sphere'({
                                radius: 0.002,
                                appearance: 'Appearance'({
                                        material: 'Material'({
                                                emissiveColor: C
                                                })
                                        })
                                })
                        ]
                })
        :-
        Item== ?match(_),
        Item == v(X,Y,Z,C).
]
-----------------------------------------------------------------------