-----------------------------------------------------------------------
-- An example of Actor Prolog program. --
-- (c) 2012 IRE RAS Alexei A. Morozov --
-----------------------------------------------------------------------
import .. from "morozov/Java3D";
class 'Main' (specialized 'Canvas3D'):
--
background_color = 'White';
--
[
PREDICATES:
--
imperative:
--
phi(Numerical) - (o);
vertices(Vertices) - (o);
--
'/'(Numerical,Numerical) = Numerical - (i,i);
'-'(Numerical) = Numerical - (i);
--
CLAUSES:
--
goal:-!,
vertices(Vertices),
Indices== [
00,01,05,06,02, 00,02,07,08,03, 00,03,09,04,01,
01,04,10,11,05, 02,06,12,13,07, 03,08,14,15,09,
05,11,16,12,06, 07,13,18,14,08, 09,15,17,10,04,
19,16,11,10,17, 19,17,15,14,18, 19,18,13,12,16],
StripCounts== [5,5,5,5,5,5,5,5,5,5,5,5],
Bounds== 'BoundingSphere'({}),
show([
'TransformGroup'({
allowTransformWrite: 'yes',
branches: [
'TransformGroup'({
transform3D: 'Transform3D'({
scale: 0.25
}),
branches: [
'Shape3D'({
geometry: geometryArray(
'GeometryInfo'({
primitive: 'POLYGON_ARRAY',
coordinates: Vertices,
coordinateIndices: Indices,
stripCounts: StripCounts,
generateNormals: 'yes'
})
),
appearance: 'Appearance'({
material: 'Material'({})
})
})
]
}),
'RotationInterpolator'({
alpha: 'Alpha3D'({
loopCount: -1,
increasingAlphaDuration: 4000
}),
schedulingBounds: Bounds
})
]
}),
'Background'({
color: color3(1.0,1.0,1.0),
applicationBounds: Bounds
}),
'AmbientLight'({
lightOn: 'yes',
color: 'Red',
influencingBounds: Bounds
}),
'PointLight'({
color: 'Green',
position: p(3,3,3),
attenuation: a(1,0,0),
influencingBounds: Bounds
}),
'PointLight'({
color: 'Orange',
position: p(-2,2,2),
attenuation: a(1,0,0),
influencingBounds: Bounds
})
]).
--
phi(Value):-
Value== 0.5*(?sqrt(5)+1).
--
vertices(Vertices):-
phi(Phi),
Vertices== [
p(1,1,1),
p(0,1/Phi,Phi),
p(Phi,0,1/Phi),
p(1/Phi,Phi,0),
p(-1,1,1),
p(0,-1/Phi,Phi),
p(1,-1,1),
p(Phi,0,-1/Phi),
p(1,1,-1),
p(-1/Phi,Phi,0),
p(-(Phi),0,1/Phi),
p(-1,-1,1),
p(1/Phi,-(Phi),0),
p(1,-1,-1),
p(0,1/Phi,-(Phi)),
p(-1,1,-1),
p(-1/Phi,-(Phi),0),
p(-(Phi),0,-1/Phi),
p(0,-1/Phi,-(Phi)),
p(-1,-1,-1)
].
]
|