Function Repository Resource:

Disk3D

Source Notebook

Create a BSplineSurface primitive representing a disk

Contributed by: Carl Woll

ResourceFunction["Disk3D"][{x, y, z}, r]

returns a BSplineSurface representation of a 3D disk with center {x,y,z} and radius r, with the normal axis in the z-direction.

ResourceFunction["Disk3D"][{x, y, z}, {r1, r2}]

returns a 3D elliptical disk with semimajor axis r1 and semiminor axis r2, and with the semimajor axis in the x-direction.

ResourceFunction["Disk3D"][{x, y, z},rads, a]

returns a 3D elliptical disk with the normal axis in the direction of vector a.

ResourceFunction["Disk3D"][{x, y, z}, rads, {u, v}]

returns a 3D elliptical disk with the semimajor axis in the direction u, and with the ellipical plane spanned by vectors u and v.

Details and Options

ResourceFunction["Disk3D"] can be used in Graphics3D.
ResourceFunction["Disk3D"] returns a BSplineSurface object.
ResourceFunction["Disk3D"][] is equivalent to ResourceFunction["Disk3D"][{0,0,0},1,{{1,0,0},{0,1,0}}].
Graphics rendering is affected by directives such as FaceForm, EdgeForm and color.

Examples

Basic Examples (3) 

A 3D disk:

In[1]:=
Graphics3D[ResourceFunction["Disk3D"][{0, 0, 0}]]
Out[1]=

A 3D elliptical disk:

In[2]:=
Graphics3D[{ResourceFunction["Disk3D"][{0, 0, 0}, {1, 3}]}]
Out[2]=

Differently-styled disks:

In[3]:=
Table[Graphics3D[{d, ResourceFunction["Disk3D"][]}], {d, {FaceForm[Red], Directive[Green, EdgeForm[Red]], EdgeForm[Directive[Green, Thickness[.05]]]}}]
Out[3]=

Scope (3) 

A disk with a normal in the direction {1,1,1}:

In[4]:=
Graphics3D[{Arrow[{{0, 0, 0}, {1, 1, 1}}], ResourceFunction["Disk3D"][{0, 0, 0}, 1, {1, 1, 1}]}]
Out[4]=

A disk in the plane spanned by the vectors {1,1,0} and {0,1,1}:

In[5]:=
With[{c = {1, 1, 1}, u = {1, 1, 0}, v = {0, 1, 1}}, Graphics3D[{Arrow[{c, c + u}], Arrow[{c, c + v}], ResourceFunction["Disk3D"][c, 1, {u, v}]}]
 ]
Out[5]=

Rendering of a fairly large number of disks:

In[6]:=
Graphics3D[{
  LightGreen,
  MapThread[
   ResourceFunction["Disk3D"],
   {RandomReal[10, {300, 3}], RandomReal[3, 300], RandomReal[1, {300, 3}]}
   ]
  }]
Out[6]=

Publisher

Carl Woll

Version History

  • 1.0.0 – 16 December 2019

Source Metadata

Related Resources

Author Notes

I’m planning to add support for specifying sectors as is done in Disk. Also it should be possible to specify Scaled centers and axis lengths.

License Information