from IPython.core.display import HTML
import numpy as np
import math
x3d is a PyPI distributed Python package maintained by the Web3D Consortium. See also a local help file x3d.x3d explaining the import statement
from x3d import x3d
.
from x3d import x3d
common_geometry is a Python package, local to this Jupyter notebook folder, which defines convenience classes for generating X3D elements with the geometric definitition pertinent to this notebook. See common_geometry.py for Python source code; common_geometry for documentation autogenerated by the pydoc documentation system.
import common_geometry
alpha_degrees = 30.0 # the half angle of the cone
beta_degrees = 30.0 # the angle the intersecting plane makes with horizontal
a = 1.0 # distance of intersecting plane to cone vertex
f = 2.5 # total height of cone
if (alpha_degrees + beta_degrees >= 90.0):
raise AssertionError("choice of alpha , beta angles geometrically invalid")
class InscribedSphere:
"""
data structure with named fields describing sphere inscribed (internally tangent)
to a cone with intersection with plane
"""
def __init__(self):
self.center = np.array((0.,0.,0.))
self.radius = 0.0
# focus is the point of tangency with the plane
self.focus = np.array((0.,0.,0.))
# contact_circle is the circular section where the sphere is in tangent contact with the cone
self.contact_circle_center = ((0.,0.,0.))
self.contact_circle_radius = 0.
def contact_circle_point(self, theta):
"""
returns a (3,) array of a point
on the circle, theta a cclockwise rotation (relative to y axis) from the x axis
"""
return self.contact_circle_center + self.contact_circle_radius * np.array((math.cos(theta),0.0, math.sin(theta)))
# convert angles to radians
alpha = math.radians(alpha_degrees)
beta = math.radians(beta_degrees)
# coordinates of points and direction vectors
pointC = np.array((0.,0.,0.))
axis = np.array((0.,-1.,0.)) # axis of cone, pointing to open end
pointB = pointC - a * axis
z = np.array((0.,0.,1.0)) # global z axis
normal = np.array((math.sin(beta), math.cos(beta),0.0))
ua = np.cross(z, normal) # a unit vector in inclined plane, largely in -x direction for beta > 0
# will be along semimajor axis of ellipse
ub = np.cross(normal, ua) # will be along semiminor axis
∡CBA = alpha
∡ACB = pi/2 - beta
∣AD is bisector of ∡BAC
DE ⊥ AC
angCBA=alpha # alpha is half angle of cone
angBAC= math.pi/2 + beta - alpha # angles in triangle sum to pi
angDAC= angBAC/2 # AD segment is angle bisector of angle BAC
angACD= math.pi/2 - beta # beta is angle that segment AC makes with horizontal
angCDA= math.pi - angDAC - angACD # angles in triangle sum to pi
# now apply law of sines
disBC = a # definition of cone dimension a
disAC = math.sin(angCBA) * disBC / math.sin(angBAC) # law of sines
disCD = math.sin(angDAC) * disAC / math.sin(angCDA) # law of sines
disBD = disBC - disCD
disDH = disBD * math.sin(angCBA)
disDF = disDH * math.sin(angCBA)
disFH = disDH * math.cos(angCBA)
disDE = disCD * math.sin(angACD)
disCE = disCD * math.cos(angACD)
upperSphere = InscribedSphere()
upperSphere.radius = disDE
upperSphere.center = pointC - disCD * axis
upperSphere.focus = pointC + disCE * ua
upperSphere.contact_circle_center = upperSphere.center - disDF * axis
upperSphere.contact_circle_radius = disFH
∡CBA = alpha
∡ACB = pi/2 - beta
∣AD is bisector of ∡BAC
DE ⊥ AC
disBC = a
angCBA=alpha
angACB= math.pi/2 + beta
angBAC= math.pi - angCBA - angACB
angCAD = (math.pi-angBAC)/2
angDCA = math.pi/2 - beta
angADC = math.pi - angCAD - angDCA
disAC = math.sin(angCBA) * disBC/math.sin(angBAC)
disCD = math.sin(angCAD) * disAC/math.sin(angADC)
disAD = math.sin(angDCA) * disAC/math.sin(angADC)
disDE = disAD * math.sin(angCAD)
disCE = disCD * math.cos(angDCA)
disBD = disBC + disCD
disDH = disBD * math.sin(angCBA)
disDF = disDH * math.sin(angCBA)
disFH = disDH * math.cos(angCBA)
lowerSphere = InscribedSphere()
lowerSphere.radius = disDE
lowerSphere.center = pointC + disCD * axis
lowerSphere.focus = pointC - disCE * ua
lowerSphere.contact_circle_center = lowerSphere.center - disDF * axis
lowerSphere.contact_circle_radius = disFH
sc = x3d.Scene()
sc.children.append( x3d.Background(skyColor = [(1,1,1)]) )
cone_shape = common_geometry.Cone(
vertex_height = a,
total_height = f,
half_angle = alpha,
appearance = x3d.Appearance(
material = x3d.Material( diffuseColor=(0.0,0.5,0.5),transparency=0.75)
)
)
plane_shape = common_geometry.TiltedPlane(
length = 2.5,
width = 2.5,
beta = beta,
appearance= x3d.Appearance( material = x3d.Material( emissiveColor=(0.8,0.6,0.6),
diffuseColor=(0.8,0.6,0.6),transparency=0.2)) )
upper_sphere = common_geometry.Sphere(
center = upperSphere.center,
radius = upperSphere.radius * 0.995 ,
appearance = x3d.Appearance( material = x3d.Material( diffuseColor=(1,1,0), transparency=0.0) )
)
upper_focus = common_geometry.Sphere(
center = upperSphere.focus,
radius = 0.02 ,
appearance = x3d.Appearance( material = x3d.Material( diffuseColor=(0,0,0), transparency=0.0) )
)
contact_circle_appearance = x3d.Appearance(
lineProperties = x3d.LineProperties( linewidthScaleFactor=1 ),
material= x3d.Material( emissiveColor = (0,0,1)) )
upper_contact_circle = common_geometry.Circle(
center = upperSphere.contact_circle_center,
radius = upperSphere.contact_circle_radius,
appearance = contact_circle_appearance
)
lower_sphere = common_geometry.Sphere(
center = lowerSphere.center,
radius = lowerSphere.radius * 0.995,
appearance = x3d.Appearance( material = x3d.Material( diffuseColor=(1,1,0.0)) )
)
lower_focus = common_geometry.Sphere(
center = lowerSphere.focus,
radius = 0.02 ,
appearance = x3d.Appearance( material = x3d.Material( diffuseColor=(0,0,0), transparency=0.0) )
)
lower_contact_circle = common_geometry.Circle(
center = lowerSphere.contact_circle_center,
radius = lowerSphere.contact_circle_radius,
appearance = contact_circle_appearance
)
figure = x3d.Transform(
rotation=(0, -1, 0 ,math.radians(20.0)),
children = [
cone_shape,
plane_shape,
upper_sphere,
upper_contact_circle,
upper_focus,
lower_sphere,
lower_contact_circle,
lower_focus
]
)
sc.children.append(figure)
Explicitly construct the ellipse which is the intersection between the plane and the cone.
Will start with a circle, then stretch it by different scales in x and z axis to be the appropriate ellipse, then rotate it around the z axis
ellipse_center = 0.5 * (lowerSphere.focus + upperSphere.focus)
# c is 1/2 distance between foci
c = 0.5 * np.sqrt( np.square( lowerSphere.focus - upperSphere.focus).sum())
semimajor = 0.5 * np.sqrt( np.square( lowerSphere.contact_circle_center - upperSphere.contact_circle_center).sum())/ math.cos(alpha)
semiminor = np.sqrt( np.square(semimajor) - np.square(c))
print("semiminor axis: %.5f" % semiminor)
print("semimajor axis: %.5f" % semimajor)
def ellipse_point(theta):
"""
for theta an angle in radians, returns point on ellipse that makes angle theta measured from center
relative to major axis
"""
return ellipse_center + \
math.cos(theta) * semimajor * ua + \
math.sin(theta) * semiminor * ub
semiminor axis: 0.61237 semimajor axis: 0.75000
ellipse_line_properties = x3d.LineProperties( applied=True, linewidthScaleFactor=3)
ellipse_material = x3d.Material(emissiveColor=(0,0,0))
appearance = x3d.Appearance( lineProperties = ellipse_line_properties, material=ellipse_material )
circular_shape = x3d.Transform(
rotation = (1.0, 0.0, 0.0, math.pi/2),
children=[
x3d.Shape(
geometry = x3d.Circle2D(radius=1.0),
appearance = appearance
)
]
)
ellipse_shape = x3d.Transform(
translation = tuple(ellipse_center),
children=[x3d.Transform(
rotation=(0 , 0, -1, beta),
children=[
x3d.Transform(
scale = (semimajor,1,semiminor),
children = [circular_shape]
)
]
) ]
)
figure.children.append(ellipse_shape)
# create polyline: upper focus to ellipse to upper contact circle
theta = math.pi * 0.75
ep = ellipse_point(theta)
phi = math.atan2(ep[2], ep[0])
print("phi %.3f" % phi)
polyline_vertices = x3d.Coordinate(
[tuple(p) for p in \
[
upperSphere.focus,
ellipse_point(theta),
upperSphere.contact_circle_point(phi),
lowerSphere.focus,
ellipse_point(theta),
lowerSphere.contact_circle_point(phi),
]
]
)
polyline_vertices.DEF='foci_segments'
polyline_indices = [0,1,2,-1,3,4,5,-1]
polyline_colors = x3d.Color(color=[(0,0,1),(1,0,0)])
polyline = x3d.Shape(
geometry = x3d.IndexedLineSet(
colorPerVertex=False,
coord = polyline_vertices,
color = polyline_colors,
coordIndex = polyline_indices,
colorIndex = [0,1],
),
appearance = x3d.Appearance( lineProperties = ellipse_line_properties, material=ellipse_material )
)
figure.children.append(polyline)
phi 0.570
NumKeyFrame = 32
keys = np.linspace(0.0, 1.0, NumKeyFrame+1, endpoint=True)
key_values = list()
for frac in keys:
theta = 2. * math.pi * frac
ep = ellipse_point(theta)
phi = math.atan2(ep[2], ep[0])
value = [tuple(p) for p in \
[
upperSphere.focus,
ep,
upperSphere.contact_circle_point(phi),
lowerSphere.focus,
ep,
lowerSphere.contact_circle_point(phi),
]
]
key_values.extend( value )
print(key_values)
interpolator = x3d.CoordinateInterpolator(
key = list(keys),
keyValue = key_values,
DEF = 'foci_segments_interpolator'
)
sc.children.append(interpolator)
route1 = x3d.ROUTE(
fromNode = 'foci_segments_interpolator',
fromField = 'value_changed',
toNode = 'foci_segments',
toField = 'point'
)
sc.children.append(route1)
time_sensor=x3d.TimeSensor(
DEF = 'timer1',
cycleInterval = 5.0,
enabled=True,
loop = True,
)
sc.children.append(time_sensor)
sc.children.append(
x3d.ROUTE(
fromNode="timer1",
fromField='fraction_changed',
toNode = 'foci_segments_interpolator',
toField = 'set_fraction'
)
)
[(-0.1584936490538903, 0.09150635094610962, 0.0), (-0.4330127018922193, 0.2499999999999999, 0.0), (-0.274519052838329, 0.5245190528383289, 3.3618887936342276e-17), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.4330127018922193, 0.2499999999999999, 0.0), (-1.0245190528383286, -0.7745190528383287, 1.2546739787239372e-16), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.42053237541917143, 0.2427944801512113, 0.1194679356736933), (-0.26406982904243154, 0.5245190528383289, 0.07501890268961717), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.42053237541917143, 0.2427944801512113, 0.1194679356736933), (-0.9855220187323815, -0.7745190528383287, 0.27997435636571666), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.38357100794733945, 0.22145482469173244, 0.2343447855778368), (-0.23425834742389046, 0.5245190528383289, 0.14312140662207418), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.38357100794733945, 0.22145482469173244, 0.2343447855778368), (-0.8742640546830807, -0.7745190528383287, 0.5341363611643053), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.32354900410049214, 0.1868011046134544, 0.3402158967942938), (-0.18918051634808303, 0.5245190528383289, 0.19892572132714756), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.32354900410049214, 0.1868011046134544, 0.3402158967942938), (-0.7060312988131602, -0.7745190528383287, 0.7424008989252021), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.24277297582573631, 0.1401650429449553, 0.4330127018922192), (-0.13425125780678018, 0.5245190528383289, 0.23945210408044176), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.24277297582573631, 0.1401650429449553, 0.4330127018922192), (-0.5010325151149313, -0.7745190528383287, 0.8936474184074792), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.1443471005899522, 0.08333883738235086, 0.5091690716927474), (-0.07487422714905587, 0.5245190528383289, 0.26411088671254135), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.1443471005899522, 0.08333883738235086, 0.5091690716927474), (-0.2794344198977294, -0.7745190528383287, 0.9856752480432718), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.03205382958058431, 0.01850628713690873, 0.5657583596134285), (-0.015528357491639888, 0.5245190528383289, 0.27407951489461063), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.03205382958058431, 0.01850628713690873, 0.5657583596134285), (-0.05795261911689284, -0.7745190528383287, 1.0228786749005172), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.08979146977226926, -0.0518411292439518, 0.6006058710551089), (0.04058990650522012, 0.5245190528383289, 0.2715016940299835), (0.5915063509461093, -0.34150635094610937, 0.0), (0.08979146977226926, -0.0518411292439518, 0.6006058710551089), (0.1514835933519519, -0.7745190528383287, 1.0132581164609176), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.21650635094610945, -0.12499999999999985, 0.6123724356957944), (0.09150635094610958, 0.5245190528383289, 0.2588190451025208), (0.5915063509461093, -0.34150635094610937, 0.0), (0.21650635094610945, -0.12499999999999985, 0.6123724356957944), (0.3415063509461092, -0.7745190528383287, 0.965925826289068), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.3432212321199496, -0.1981588707560479, 0.6006058710551089), (0.13620493952643523, 0.5245190528383289, 0.23834622887692894), (0.5915063509461093, -0.34150635094610937, 0.0), (0.3432212321199496, -0.1981588707560479, 0.6006058710551089), (0.5083237545545024, -0.7745190528383287, 0.8895202359611387), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.4650665314728032, -0.26850628713690844, 0.5657583596134285), (0.1743233574166868, 0.5245190528383289, 0.21206621001523873), (0.5915063509461093, -0.34150635094610937, 0.0), (0.4650665314728032, -0.26850628713690844, 0.5657583596134285), (0.6505836268250637, -0.7745190528383287, 0.7914418703454424), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.5773598024821709, -0.3333388373823505, 0.5091690716927476), (0.2058918393738914, 0.5245190528383289, 0.18157439480964538), (0.5915063509461093, -0.34150635094610937, 0.0), (0.5773598024821709, -0.3333388373823505, 0.5091690716927476), (0.7683988054071726, -0.7745190528383287, 0.6776448667831669), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.6757856777179552, -0.390165042944955, 0.43301270189221924), (0.23114033527913153, 0.5245190528383289, 0.1481042058089639), (0.5915063509461093, -0.34150635094610937, 0.0), (0.6757856777179552, -0.390165042944955, 0.43301270189221924), (0.8626274749402234, -0.7745190528383287, 0.5527324208936907), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.7565617059927112, -0.4368011046134542, 0.3402158967942938), (0.2503691536682408, 0.5245190528383289, 0.11258773140401258), (0.5915063509461093, -0.34150635094610937, 0.0), (0.7565617059927112, -0.4368011046134542, 0.3402158967942938), (0.934390402137894, -0.7745190528383287, 0.4201831339086928), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.8165837098395584, -0.4714548246917322, 0.23434478557783683), (0.2638681047327746, 0.5245190528383289, 0.07572538330036213), (0.5915063509461093, -0.34150635094610937, 0.0), (0.8165837098395584, -0.4714548246917322, 0.23434478557783683), (0.9847691733596201, -0.7745190528383287, 0.2826109778995791), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.8535450773113904, -0.4927944801512111, 0.11946793567369351), (0.27186891913218497, 0.5245190528383289, 0.03805261070085376), (0.5915063509461093, -0.34150635094610937, 0.0), (0.8535450773113904, -0.4927944801512111, 0.11946793567369351), (1.0146286192001484, -0.7745190528383287, 0.1420142764962253), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.8660254037844383, -0.49999999999999967, 7.49939943260923e-17), (0.274519052838329, 0.5245190528383289, 2.3772143635738242e-17), (0.5915063509461093, -0.34150635094610937, 0.0), (0.8660254037844383, -0.49999999999999967, 7.49939943260923e-17), (1.0245190528383286, -0.7745190528383287, 8.871884785340021e-17), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.8535450773113904, -0.4927944801512111, -0.11946793567369338), (0.27186891913218497, 0.5245190528383289, -0.03805261070085371), (0.5915063509461093, -0.34150635094610937, 0.0), (0.8535450773113904, -0.4927944801512111, -0.11946793567369338), (1.0146286192001484, -0.7745190528383287, -0.14201427649622514), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.8165837098395584, -0.4714548246917322, -0.23434478557783675), (0.2638681047327746, 0.5245190528383289, -0.0757253833003621), (0.5915063509461093, -0.34150635094610937, 0.0), (0.8165837098395584, -0.4714548246917322, -0.23434478557783675), (0.9847691733596201, -0.7745190528383287, -0.282610977899579), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.7565617059927112, -0.4368011046134542, -0.3402158967942937), (0.2503691536682408, 0.5245190528383289, -0.11258773140401257), (0.5915063509461093, -0.34150635094610937, 0.0), (0.7565617059927112, -0.4368011046134542, -0.3402158967942937), (0.934390402137894, -0.7745190528383287, -0.4201831339086927), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.6757856777179553, -0.3901650429449551, -0.4330127018922192), (0.23114033527913155, 0.5245190528383289, -0.14810420580896388), (0.5915063509461093, -0.34150635094610937, 0.0), (0.6757856777179553, -0.3901650429449551, -0.4330127018922192), (0.8626274749402235, -0.7745190528383287, -0.5527324208936906), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.5773598024821711, -0.3333388373823506, -0.5091690716927475), (0.20589183937389144, 0.5245190528383289, -0.18157439480964532), (0.5915063509461093, -0.34150635094610937, 0.0), (0.5773598024821711, -0.3333388373823506, -0.5091690716927475), (0.7683988054071728, -0.7745190528383287, -0.6776448667831667), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.4650665314728036, -0.26850628713690866, -0.5657583596134284), (0.17432335741668692, 0.5245190528383289, -0.21206621001523865), (0.5915063509461093, -0.34150635094610937, 0.0), (0.4650665314728036, -0.26850628713690866, -0.5657583596134284), (0.6505836268250641, -0.7745190528383287, -0.7914418703454421), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.3432212321199499, -0.19815887075604807, -0.6006058710551088), (0.1362049395264354, 0.5245190528383289, -0.23834622887692886), (0.5915063509461093, -0.34150635094610937, 0.0), (0.3432212321199499, -0.19815887075604807, -0.6006058710551088), (0.5083237545545031, -0.7745190528383287, -0.8895202359611384), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.2165063509461096, -0.12499999999999994, -0.6123724356957944), (0.09150635094610965, 0.5245190528383289, -0.2588190451025208), (0.5915063509461093, -0.34150635094610937, 0.0), (0.2165063509461096, -0.12499999999999994, -0.6123724356957944), (0.3415063509461094, -0.7745190528383287, -0.9659258262890679), (-0.1584936490538903, 0.09150635094610962, 0.0), (0.08979146977226929, -0.05184112924395182, -0.6006058710551089), (0.04058990650522012, 0.5245190528383289, -0.2715016940299835), (0.5915063509461093, -0.34150635094610937, 0.0), (0.08979146977226929, -0.05184112924395182, -0.6006058710551089), (0.1514835933519519, -0.7745190528383287, -1.0132581164609176), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.03205382958058442, 0.018506287136908786, -0.5657583596134285), (-0.015528357491639949, 0.5245190528383289, -0.27407951489461063), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.03205382958058442, 0.018506287136908786, -0.5657583596134285), (-0.05795261911689307, -0.7745190528383287, -1.0228786749005172), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.14434710058995187, 0.08333883738235069, -0.5091690716927476), (-0.07487422714905569, 0.5245190528383289, -0.2641108867125414), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.14434710058995187, 0.08333883738235069, -0.5091690716927476), (-0.2794344198977287, -0.7745190528383287, -0.985675248043272), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.2427729758257362, 0.14016504294495524, -0.4330127018922193), (-0.13425125780678007, 0.5245190528383289, -0.23945210408044185), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.2427729758257362, 0.14016504294495524, -0.4330127018922193), (-0.5010325151149309, -0.7745190528383287, -0.8936474184074794), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.32354900410049214, 0.1868011046134544, -0.3402158967942938), (-0.18918051634808303, 0.5245190528383289, -0.19892572132714756), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.32354900410049214, 0.1868011046134544, -0.3402158967942938), (-0.7060312988131602, -0.7745190528383287, -0.7424008989252021), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.3835710079473392, 0.22145482469173233, -0.2343447855778372), (-0.23425834742389035, 0.5245190528383289, -0.14312140662207434), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.3835710079473392, 0.22145482469173233, -0.2343447855778372), (-0.8742640546830802, -0.7745190528383287, -0.534136361164306), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.4205323754191713, 0.24279448015121124, -0.1194679356736936), (-0.2640698290424315, 0.5245190528383289, -0.07501890268961739), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.4205323754191713, 0.24279448015121124, -0.1194679356736936), (-0.9855220187323813, -0.7745190528383287, -0.2799743563657175), (-0.1584936490538903, 0.09150635094610962, 0.0), (-0.4330127018922193, 0.2499999999999999, -1.499879886521846e-16), (-0.274519052838329, 0.5245190528383289, -1.555298372001034e-16), (0.5915063509461093, -0.34150635094610937, 0.0), (-0.4330127018922193, 0.2499999999999999, -1.499879886521846e-16), (-1.0245190528383286, -0.7745190528383287, -5.804452545237016e-16)]
%%html
<script type='text/javascript' charset="UTF-8" src='https://x3dom.org/release/x3dom-full.debug.js'> </script>
<link rel='stylesheet' type='text/css' href='https://x3dom.org/release/x3dom.css'></link>
<style>
x3d {
width:720px;
height:720px;
border:2px solid black;
}
</style>
x3dnode = """\
<x3d>
%s
</x3d>
<script>
window.x3dom.reload()
</script>
""" % sc.HTML5()
#print(x3dnode)
HTML(x3dnode)
if (True):
print(sc.XML())
<Scene> <Background skyColor='1 1 1'/> <Transform rotation='0 -1 0 0.3490658503988659'> <Transform translation='0.0 -0.25 0.0'> <Shape> <Appearance> <Material diffuseColor='0.0 0.5 0.5' transparency='0.75'/> </Appearance> <Cone bottomRadius='1.443375672974064' height='2.5'/> </Shape> </Transform> <Shape> <Appearance> <Material diffuseColor='0.8 0.6 0.6' emissiveColor='0.8 0.6 0.6' transparency='0.2'/> </Appearance> <IndexedFaceSet coordIndex='0 1 2 3 -1' solid='false'> <Coordinate point='1.0825317547305484 -0.6249999999999999 1.25 -1.0825317547305484 0.6249999999999999 1.25 -1.0825317547305484 0.6249999999999999 -1.25 1.0825317547305484 -0.6249999999999999 -1.25'/> </IndexedFaceSet> </Shape> <Transform translation='0.0 0.3660254037844386 0.0'> <Shape> <Appearance> <Material diffuseColor='1 1 0'/> </Appearance> <Sphere radius='0.3154023616172417'/> </Shape> </Transform> <Transform translation='0.0 0.5245190528383289 0.0'> <Transform rotation='1.0 0.0 0.0 1.5707963267948966'> <Shape> <Appearance> <LineProperties linewidthScaleFactor='1'/> <Material emissiveColor='0 0 1'/> </Appearance> <Circle2D radius='0.274519052838329'/> </Shape> </Transform> </Transform> <Transform translation='-0.1584936490538903 0.09150635094610962 0.0'> <Shape> <Appearance> <Material diffuseColor='0 0 0'/> </Appearance> <Sphere radius='0.02'/> </Shape> </Transform> <Transform translation='0.0 -1.366025403784438 0.0'> <Shape> <Appearance> <Material diffuseColor='1 1 0.0'/> </Appearance> <Sphere radius='1.1770976383827578'/> </Shape> </Transform> <Transform translation='0.0 -0.7745190528383287 0.0'> <Transform rotation='1.0 0.0 0.0 1.5707963267948966'> <Shape> <Appearance> <LineProperties linewidthScaleFactor='1'/> <Material emissiveColor='0 0 1'/> </Appearance> <Circle2D radius='1.0245190528383286'/> </Shape> </Transform> </Transform> <Transform translation='0.5915063509461093 -0.34150635094610937 0.0'> <Shape> <Appearance> <Material diffuseColor='0 0 0'/> </Appearance> <Sphere radius='0.02'/> </Shape> </Transform> <Transform translation='0.21650635094610948 -0.12499999999999988 0.0'> <Transform rotation='0 0 -1 0.5235987755982988'> <Transform scale='0.7499999999999997 1 0.6123724356957944'> <Transform rotation='1.0 0.0 0.0 1.5707963267948966'> <Shape> <Appearance> <LineProperties linewidthScaleFactor='3'/> <Material/> </Appearance> <Circle2D/> </Shape> </Transform> </Transform> </Transform> </Transform> <Shape> <Appearance> <LineProperties linewidthScaleFactor='3'/> <Material/> </Appearance> <IndexedLineSet colorIndex='0 1' colorPerVertex='false' coordIndex='0 1 2 -1 3 4 5 -1'> <Color color='0 0 1 1 0 0'/> <Coordinate DEF='foci_segments' point='-0.1584936490538903 0.09150635094610962 0.0 0.6757856777179552 -0.390165042944955 0.43301270189221924 0.23114033527913153 0.5245190528383289 0.1481042058089639 0.5915063509461093 -0.34150635094610937 0.0 0.6757856777179552 -0.390165042944955 0.43301270189221924 0.8626274749402234 -0.7745190528383287 0.5527324208936907'/> </IndexedLineSet> </Shape> </Transform> <CoordinateInterpolator DEF='foci_segments_interpolator' key='0.0 0.03125 0.0625 0.09375 0.125 0.15625 0.1875 0.21875 0.25 0.28125 0.3125 0.34375 0.375 0.40625 0.4375 0.46875 0.5 0.53125 0.5625 0.59375 0.625 0.65625 0.6875 0.71875 0.75 0.78125 0.8125 0.84375 0.875 0.90625 0.9375 0.96875 1.0' keyValue='-0.1584936490538903 0.09150635094610962 0.0 -0.4330127018922193 0.2499999999999999 0.0 -0.274519052838329 0.5245190528383289 3.3618887936342276e-17 0.5915063509461093 -0.34150635094610937 0.0 -0.4330127018922193 0.2499999999999999 0.0 -1.0245190528383286 -0.7745190528383287 1.2546739787239372e-16 -0.1584936490538903 0.09150635094610962 0.0 -0.42053237541917143 0.2427944801512113 0.1194679356736933 -0.26406982904243154 0.5245190528383289 0.07501890268961717 0.5915063509461093 -0.34150635094610937 0.0 -0.42053237541917143 0.2427944801512113 0.1194679356736933 -0.9855220187323815 -0.7745190528383287 0.27997435636571666 -0.1584936490538903 0.09150635094610962 0.0 -0.38357100794733945 0.22145482469173244 0.2343447855778368 -0.23425834742389046 0.5245190528383289 0.14312140662207418 0.5915063509461093 -0.34150635094610937 0.0 -0.38357100794733945 0.22145482469173244 0.2343447855778368 -0.8742640546830807 -0.7745190528383287 0.5341363611643053 -0.1584936490538903 0.09150635094610962 0.0 -0.32354900410049214 0.1868011046134544 0.3402158967942938 -0.18918051634808303 0.5245190528383289 0.19892572132714756 0.5915063509461093 -0.34150635094610937 0.0 -0.32354900410049214 0.1868011046134544 0.3402158967942938 -0.7060312988131602 -0.7745190528383287 0.7424008989252021 -0.1584936490538903 0.09150635094610962 0.0 -0.24277297582573631 0.1401650429449553 0.4330127018922192 -0.13425125780678018 0.5245190528383289 0.23945210408044176 0.5915063509461093 -0.34150635094610937 0.0 -0.24277297582573631 0.1401650429449553 0.4330127018922192 -0.5010325151149313 -0.7745190528383287 0.8936474184074792 -0.1584936490538903 0.09150635094610962 0.0 -0.1443471005899522 0.08333883738235086 0.5091690716927474 -0.07487422714905587 0.5245190528383289 0.26411088671254135 0.5915063509461093 -0.34150635094610937 0.0 -0.1443471005899522 0.08333883738235086 0.5091690716927474 -0.2794344198977294 -0.7745190528383287 0.9856752480432718 -0.1584936490538903 0.09150635094610962 0.0 -0.03205382958058431 0.01850628713690873 0.5657583596134285 -0.015528357491639888 0.5245190528383289 0.27407951489461063 0.5915063509461093 -0.34150635094610937 0.0 -0.03205382958058431 0.01850628713690873 0.5657583596134285 -0.05795261911689284 -0.7745190528383287 1.0228786749005172 -0.1584936490538903 0.09150635094610962 0.0 0.08979146977226926 -0.0518411292439518 0.6006058710551089 0.04058990650522012 0.5245190528383289 0.2715016940299835 0.5915063509461093 -0.34150635094610937 0.0 0.08979146977226926 -0.0518411292439518 0.6006058710551089 0.1514835933519519 -0.7745190528383287 1.0132581164609176 -0.1584936490538903 0.09150635094610962 0.0 0.21650635094610945 -0.12499999999999985 0.6123724356957944 0.09150635094610958 0.5245190528383289 0.2588190451025208 0.5915063509461093 -0.34150635094610937 0.0 0.21650635094610945 -0.12499999999999985 0.6123724356957944 0.3415063509461092 -0.7745190528383287 0.965925826289068 -0.1584936490538903 0.09150635094610962 0.0 0.3432212321199496 -0.1981588707560479 0.6006058710551089 0.13620493952643523 0.5245190528383289 0.23834622887692894 0.5915063509461093 -0.34150635094610937 0.0 0.3432212321199496 -0.1981588707560479 0.6006058710551089 0.5083237545545024 -0.7745190528383287 0.8895202359611387 -0.1584936490538903 0.09150635094610962 0.0 0.4650665314728032 -0.26850628713690844 0.5657583596134285 0.1743233574166868 0.5245190528383289 0.21206621001523873 0.5915063509461093 -0.34150635094610937 0.0 0.4650665314728032 -0.26850628713690844 0.5657583596134285 0.6505836268250637 -0.7745190528383287 0.7914418703454424 -0.1584936490538903 0.09150635094610962 0.0 0.5773598024821709 -0.3333388373823505 0.5091690716927476 0.2058918393738914 0.5245190528383289 0.18157439480964538 0.5915063509461093 -0.34150635094610937 0.0 0.5773598024821709 -0.3333388373823505 0.5091690716927476 0.7683988054071726 -0.7745190528383287 0.6776448667831669 -0.1584936490538903 0.09150635094610962 0.0 0.6757856777179552 -0.390165042944955 0.43301270189221924 0.23114033527913153 0.5245190528383289 0.1481042058089639 0.5915063509461093 -0.34150635094610937 0.0 0.6757856777179552 -0.390165042944955 0.43301270189221924 0.8626274749402234 -0.7745190528383287 0.5527324208936907 -0.1584936490538903 0.09150635094610962 0.0 0.7565617059927112 -0.4368011046134542 0.3402158967942938 0.2503691536682408 0.5245190528383289 0.11258773140401258 0.5915063509461093 -0.34150635094610937 0.0 0.7565617059927112 -0.4368011046134542 0.3402158967942938 0.934390402137894 -0.7745190528383287 0.4201831339086928 -0.1584936490538903 0.09150635094610962 0.0 0.8165837098395584 -0.4714548246917322 0.23434478557783683 0.2638681047327746 0.5245190528383289 0.07572538330036213 0.5915063509461093 -0.34150635094610937 0.0 0.8165837098395584 -0.4714548246917322 0.23434478557783683 0.9847691733596201 -0.7745190528383287 0.2826109778995791 -0.1584936490538903 0.09150635094610962 0.0 0.8535450773113904 -0.4927944801512111 0.11946793567369351 0.27186891913218497 0.5245190528383289 0.03805261070085376 0.5915063509461093 -0.34150635094610937 0.0 0.8535450773113904 -0.4927944801512111 0.11946793567369351 1.0146286192001484 -0.7745190528383287 0.1420142764962253 -0.1584936490538903 0.09150635094610962 0.0 0.8660254037844383 -0.49999999999999967 7.49939943260923e-17 0.274519052838329 0.5245190528383289 2.3772143635738242e-17 0.5915063509461093 -0.34150635094610937 0.0 0.8660254037844383 -0.49999999999999967 7.49939943260923e-17 1.0245190528383286 -0.7745190528383287 8.871884785340021e-17 -0.1584936490538903 0.09150635094610962 0.0 0.8535450773113904 -0.4927944801512111 -0.11946793567369338 0.27186891913218497 0.5245190528383289 -0.03805261070085371 0.5915063509461093 -0.34150635094610937 0.0 0.8535450773113904 -0.4927944801512111 -0.11946793567369338 1.0146286192001484 -0.7745190528383287 -0.14201427649622514 -0.1584936490538903 0.09150635094610962 0.0 0.8165837098395584 -0.4714548246917322 -0.23434478557783675 0.2638681047327746 0.5245190528383289 -0.0757253833003621 0.5915063509461093 -0.34150635094610937 0.0 0.8165837098395584 -0.4714548246917322 -0.23434478557783675 0.9847691733596201 -0.7745190528383287 -0.282610977899579 -0.1584936490538903 0.09150635094610962 0.0 0.7565617059927112 -0.4368011046134542 -0.3402158967942937 0.2503691536682408 0.5245190528383289 -0.11258773140401257 0.5915063509461093 -0.34150635094610937 0.0 0.7565617059927112 -0.4368011046134542 -0.3402158967942937 0.934390402137894 -0.7745190528383287 -0.4201831339086927 -0.1584936490538903 0.09150635094610962 0.0 0.6757856777179553 -0.3901650429449551 -0.4330127018922192 0.23114033527913155 0.5245190528383289 -0.14810420580896388 0.5915063509461093 -0.34150635094610937 0.0 0.6757856777179553 -0.3901650429449551 -0.4330127018922192 0.8626274749402235 -0.7745190528383287 -0.5527324208936906 -0.1584936490538903 0.09150635094610962 0.0 0.5773598024821711 -0.3333388373823506 -0.5091690716927475 0.20589183937389144 0.5245190528383289 -0.18157439480964532 0.5915063509461093 -0.34150635094610937 0.0 0.5773598024821711 -0.3333388373823506 -0.5091690716927475 0.7683988054071728 -0.7745190528383287 -0.6776448667831667 -0.1584936490538903 0.09150635094610962 0.0 0.4650665314728036 -0.26850628713690866 -0.5657583596134284 0.17432335741668692 0.5245190528383289 -0.21206621001523865 0.5915063509461093 -0.34150635094610937 0.0 0.4650665314728036 -0.26850628713690866 -0.5657583596134284 0.6505836268250641 -0.7745190528383287 -0.7914418703454421 -0.1584936490538903 0.09150635094610962 0.0 0.3432212321199499 -0.19815887075604807 -0.6006058710551088 0.1362049395264354 0.5245190528383289 -0.23834622887692886 0.5915063509461093 -0.34150635094610937 0.0 0.3432212321199499 -0.19815887075604807 -0.6006058710551088 0.5083237545545031 -0.7745190528383287 -0.8895202359611384 -0.1584936490538903 0.09150635094610962 0.0 0.2165063509461096 -0.12499999999999994 -0.6123724356957944 0.09150635094610965 0.5245190528383289 -0.2588190451025208 0.5915063509461093 -0.34150635094610937 0.0 0.2165063509461096 -0.12499999999999994 -0.6123724356957944 0.3415063509461094 -0.7745190528383287 -0.9659258262890679 -0.1584936490538903 0.09150635094610962 0.0 0.08979146977226929 -0.05184112924395182 -0.6006058710551089 0.04058990650522012 0.5245190528383289 -0.2715016940299835 0.5915063509461093 -0.34150635094610937 0.0 0.08979146977226929 -0.05184112924395182 -0.6006058710551089 0.1514835933519519 -0.7745190528383287 -1.0132581164609176 -0.1584936490538903 0.09150635094610962 0.0 -0.03205382958058442 0.018506287136908786 -0.5657583596134285 -0.015528357491639949 0.5245190528383289 -0.27407951489461063 0.5915063509461093 -0.34150635094610937 0.0 -0.03205382958058442 0.018506287136908786 -0.5657583596134285 -0.05795261911689307 -0.7745190528383287 -1.0228786749005172 -0.1584936490538903 0.09150635094610962 0.0 -0.14434710058995187 0.08333883738235069 -0.5091690716927476 -0.07487422714905569 0.5245190528383289 -0.2641108867125414 0.5915063509461093 -0.34150635094610937 0.0 -0.14434710058995187 0.08333883738235069 -0.5091690716927476 -0.2794344198977287 -0.7745190528383287 -0.985675248043272 -0.1584936490538903 0.09150635094610962 0.0 -0.2427729758257362 0.14016504294495524 -0.4330127018922193 -0.13425125780678007 0.5245190528383289 -0.23945210408044185 0.5915063509461093 -0.34150635094610937 0.0 -0.2427729758257362 0.14016504294495524 -0.4330127018922193 -0.5010325151149309 -0.7745190528383287 -0.8936474184074794 -0.1584936490538903 0.09150635094610962 0.0 -0.32354900410049214 0.1868011046134544 -0.3402158967942938 -0.18918051634808303 0.5245190528383289 -0.19892572132714756 0.5915063509461093 -0.34150635094610937 0.0 -0.32354900410049214 0.1868011046134544 -0.3402158967942938 -0.7060312988131602 -0.7745190528383287 -0.7424008989252021 -0.1584936490538903 0.09150635094610962 0.0 -0.3835710079473392 0.22145482469173233 -0.2343447855778372 -0.23425834742389035 0.5245190528383289 -0.14312140662207434 0.5915063509461093 -0.34150635094610937 0.0 -0.3835710079473392 0.22145482469173233 -0.2343447855778372 -0.8742640546830802 -0.7745190528383287 -0.534136361164306 -0.1584936490538903 0.09150635094610962 0.0 -0.4205323754191713 0.24279448015121124 -0.1194679356736936 -0.2640698290424315 0.5245190528383289 -0.07501890268961739 0.5915063509461093 -0.34150635094610937 0.0 -0.4205323754191713 0.24279448015121124 -0.1194679356736936 -0.9855220187323813 -0.7745190528383287 -0.2799743563657175 -0.1584936490538903 0.09150635094610962 0.0 -0.4330127018922193 0.2499999999999999 -1.499879886521846e-16 -0.274519052838329 0.5245190528383289 -1.555298372001034e-16 0.5915063509461093 -0.34150635094610937 0.0 -0.4330127018922193 0.2499999999999999 -1.499879886521846e-16 -1.0245190528383286 -0.7745190528383287 -5.804452545237016e-16'/> <ROUTE fromField='value_changed' fromNode='foci_segments_interpolator' toField='point' toNode='foci_segments'/> <TimeSensor DEF='timer1' cycleInterval='5.0' loop='true'/> <ROUTE fromField='fraction_changed' fromNode='timer1' toField='set_fraction' toNode='foci_segments_interpolator'/> </Scene>