Skip to content
Projects

SlantedTube

Download notebookView on GitHubRun when the site was built.

A tube or rod whose far end is cut by a slanted plane, like the mouth of an oven nozzle cut at 45°.

SlantedTube(start, end, inner_radius, outer_radius, cut_normal) has a flat face at start and a cut through end with the outward normal cut_normal; inner_radius=0 gives a solid rod. Its level set is a bound on the distance, exact on the faces, and its crossings are analytic.

import matplotlib.pyplot as plt
import numpy as np
from simgeometry import SlantedTube
c = np.cos(np.pi / 4)
nozzle = SlantedTube(
(0.0, 0.0, 0.0), (0.0, 0.0, 1.0), 0.15, 0.2, cut_normal=(0.0, -c, c)
)
print(f"cut angle: {nozzle.cut_angle:.0f} deg, volume: {nozzle.volume():.4f}")
print("wall at y = +0.175, z = 1.1 (long side):", nozzle.contains((0.0, 0.175, 1.1)))
print("wall at y = -0.175, z = 1.1 (short side):", nozzle.contains((0.0, -0.175, 1.1)))
assert nozzle.contains((0.0, 0.175, 1.1)) and not nozzle.contains((0.0, -0.175, 1.1))
cut angle: 45 deg, volume: 0.0550
wall at y = +0.175, z = 1.1 (long side): True
wall at y = -0.175, z = 1.1 (short side): False

The section x = 0 shows the wall on both sides of the bore and the 45° mouth.

ax = nozzle.show(x=0.0, resolution=200, display=False)
ax.set_title("The section x = 0 of a SlantedTube")
plt.show()
Notebook output
import plasma_plots
import pyvista as pv
pv.OFF_SCREEN = True # render without a window, e.g. on a docs server
plotter = nozzle.show_3d(
backend="pyvista", display=False, resolution=72, opacity=0.6, show_bounds=False
)
plasma_plots.scene(plotter, alt="A tube whose end is cut at 45 degrees")
A tube whose end is cut at 45 degrees
Open in a new tab