Cylinder#
[1]:
import fresnel
scene = fresnel.Scene()
The cylinder geometry defines a set of N spherocylinders. Each spherocylinder is defined by two end points and has its own radius, and end point colors.
[2]:
geometry = fresnel.geometry.Cylinder(scene, N=3)
geometry.material = fresnel.material.Material(color=fresnel.color.linear([0.25,0.5,0.9]),
roughness=0.8)
Geometric properties#
points defines the end points of each cylinder.
[3]:
geometry.points[:] = [[[-5,-1,-1], [-2, 1, 1]],
[[1, -2, 1],[0, 2, -1]],
[[5, -1.5, 2], [3, 1.5, -2]]]
radius sets the radius of each spherocylinder.
[4]:
geometry.radius[:] = [0.5, 1.0, 1.5]
[5]:
scene.camera = fresnel.camera.Orthographic.fit(scene, view='front', margin=0.5)
fresnel.preview(scene)
[5]:
Color#
color sets the color of the end points of each cylinder (when primitive_color_mix > 0). The color transitions at the midpoint.
[6]:
geometry.color[:] = [[[0.9,0,0], [0.9, 0, 0]],
[[0, 0.9, 0], [0, 0.9, 0.9]],
[[0.9, 0.9, 0], [0, 0, 0.9]]]
geometry.material.primitive_color_mix = 1.0
[7]:
fresnel.preview(scene)
[7]:
Outlines#
Outlines are applied on the outer edge of the cylinder in the view plane.
[8]:
geometry.outline_width = 0.05
[9]:
fresnel.preview(scene)
[9]:
This page was generated from a jupyter notebook. You can download and run the notebook locally from the fresnel-examples repository.