Function torus computes the X, Y and Z arrays to visualize a torus with model Torus. The left image below shows a torus with ri=0.5 m and ro = 0.2 m. The right images below shows the torus with the additional parameter settings:
opening = 45 degree startAngle = -135 degree stopAngle = 135 degree
function torus extends Modelica.Mechanics.MultiBody.Interfaces.partialSurfaceCharacteristic(final multiColoredSurface = false); input Modelica.SIunits.Length ri = 1 "Major radius (distance from center of torus to center of tube)" annotation( Dialog); input Modelica.SIunits.Length ro = 0.2 "Minor radius (radius of tube)" annotation( Dialog); input Modelica.SIunits.Angle opening = 0 "Opening angle of torus" annotation( Dialog); input Modelica.SIunits.Angle startAngle = -Modelica.Constants.pi "Start angle of torus slice" annotation( Dialog); input Modelica.SIunits.Angle stopAngle = Modelica.Constants.pi "End angle of torus slice" annotation( Dialog); end torus;