Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate a BSplineCurve primitive representing a circle
ResourceFunction["SplineCircle"][{x,y}, r] returns a BSplineCurve representation of a 2D circle with center {x,y} and radius r. | |
ResourceFunction["SplineCircle"][{x, y}, {r1,r2}] returns a 2D ellipse with semimajor axis r1 and semiminor axis r2, and with the semimajor axis in the x direction. | |
ResourceFunction["SplineCircle"][{x, y}, {r1,r2}, u] returns a 2D ellipse with the semimajor axis in the direction u. | |
ResourceFunction["SplineCircle"][{x, y}, {r1,r2}, u, {θ1, θ2}] returns a 2D elliptical arc from θ1 to θ2 measured from the semimajor axis. | |
ResourceFunction["SplineCircle"][{x, y, z}, r] returns a BSplineCurve representation of a 3D circle with center {x,y,z} and radius r, with the symmetry axis in the z direction. | |
ResourceFunction["SplineCircle"][{x, y, z},{r1,r2}] returns a 3D ellipse with semimajor axis r1 and semiminor axis r2, and with the semimajor axis in the x direction. | |
ResourceFunction["SplineCircle"][{x, y, z},{r1,r2}, a] returns a 3D ellipse with the symmetry axis in the direction a. | |
ResourceFunction["SplineCircle"][{x, y, z}, {r1,r2}, {u, v}] returns a 3D ellipse with the semimajor axis in the direction u, and with the elliptical plane being spanned by u and v. | |
ResourceFunction["SplineCircle"][{x, y, z},{r1,r2}, p, {θ1, θ2}] returns a 3D elliptical arc in the plane specified by p, where p can be the symmetry axis or the plane spanned by 3D vectors u and v. |
A 2D circle:
In[1]:= |
![]() |
Out[1]= |
![]() |
A 2D elliptical arc:
In[2]:= |
![]() |
Out[2]= |
![]() |
A 2D ellipse with semimajor axis in the direction {4, 1}:
In[3]:= |
![]() |
Out[3]= |
![]() |
Differently styled ellipses:
In[4]:= |
![]() |
Out[4]= |
![]() |
A 3D circle:
In[5]:= |
![]() |
Out[5]= |
![]() |
A 3D ellipse:
In[6]:= |
![]() |
Out[6]= |
![]() |
A 3D elliptical arc:
In[7]:= |
![]() |
Out[7]= |
![]() |
Use SplineCircle as a FilledCurve specification:
In[8]:= |
![]() |
Out[8]= |
![]() |
Use SplineCircle as a Tube curve specification:
In[9]:= |
![]() |
Out[9]= |
![]() |
Use SplineCircle as an Arrow curve specification:
In[10]:= |
![]() |
Out[14]= |
![]() |
Rendering of a fairly large number of circle tubes:
In[15]:= |
![]() |
Out[15]= |
![]() |
A 2D SplineCircle with a non-default semimajor axis is equivalent to a geometric transformation of a Circle object:
In[16]:= |
![]() |
Out[16]= |
![]() |
The Circle equivalent:
In[17]:= |
![]() |
Out[17]= |
![]() |
When only a symmetry axis {x,y,z} is specified, the largest component of the symmetry axis is computed, and the third coordinate starting with the largest component in a RHS is determined. Then the semimajor axis is assumed to be perpendicular to both the third component and the symmetry axis. For example, suppose the symmetry axis is:
In[18]:= |
![]() |
The largest component is in the z direction, and so the third coordinate would be the y coordinate. Then the semimajor axis is assumed to be in the direction:
In[19]:= |
![]() |
Out[19]= |
![]() |
Check:
In[20]:= |
![]() |
Out[20]= |
![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License