# Parametric Equation for Rectangular Tubing with Corner Radius

I'm working on a problem where I need the parametric equation for a complex shape.

Parametric equation of a circle:

x = a * cos θ
y = a * sin θ

Parametric equation of an ellipse:

x = a * cos θ
y = b * sin θ

Parametric equation of a rectangle, reference:

x = a * (|cos θ| * cos θ + |sin θ| * sin θ)
y = b * (|cos θ| * cos θ - |sin θ| * sin θ)

Parametric equation of a tubing with radius at the corners:

??  inputs = a, b and material thickness (i.e. corner radius = 2 * thickness)

The shape I'm trying to model is hollow rectangular steel tubing. As manufactured, hollow steel tubing has a 'corner' radius = two times material thickness, per standard ASTM A500-10.

Ultimately I'm working on a free tube notching calculator and pattern generator. I'd like to add a feature for rectangular tubing to rectangular tubing. I'm really relying on the parametric angular input to complete the model. I'm pulling out my hair trying to develop a functional parametric equation for the hollow steel outer shape (with radius at each corner) to use in my Descriptive Geometry analysis.

Any recommendations on how to proceed here to obtain a parametrized form of a rectangle with sized corner radius?

• Do you insist on a parametric form? Otherwise a piece wise defined function will do the job. – Michael Hoppe Oct 8 '16 at 6:15
• Basically, you want to corner fillet a rectangle? – J. M. is a poor mathematician Oct 8 '16 at 6:15
• @Michael, you certainly could have piecewise functions as the components of a parametric equation. I imagine B-splines and ilk would be particularly useful. – J. M. is a poor mathematician Oct 8 '16 at 6:16
• It can be a piece wise function (I'm just using JavaScript...) but I'm really relying on the angle theta, θ as the input. I can iterate θ, perform a test, chose formula A or formula B to obtain X, Y results, iterate and repeat no problem. But the whole thing depends on that angle as the input parameter. – zipzit Oct 8 '16 at 6:34
• @zipzit : "why Knot" excellent pun. – Jean Marie Oct 8 '16 at 7:15

Piecewise vs Parametric

As discussed in the comments this can be done piecewise or parametrically. The difference is minor. Any pieces of a piecewise function can be joined into a single function by the following:

$$f(t)=\begin{cases} f_1(t) & a_0

$$f(t)=p[a_0,a_1,t]f_1(t)+p[a_1,a_2,t]f_2(t)+p[a_2,a_3,t]f_3(t)+\cdots$$

where $$p[n,m,x]=\frac{1}{2}\left(1-\frac{|x-n|}{x-n}\cdot\frac{|x-m|}{x-m}\right)$$. The function $$p$$ returns $$1$$ when $$n and $$0$$ otherwise.

Piecewise Solution

$$a$$ is the horizontal "radius" of the pipe. I.e. the horizontal distance between the two sides is $$2a$$.

$$b$$ is the vertical "radius" of the pipe. I.e. the vertical distance between the two sides is $$2b$$.

$$r$$ is the radius of the corner pieces.

$$f(t)=\begin{cases} \{a,-(b-r)(2t-1)\} & 0\le t\le 1 \\ \left\{a-r+r \cos \left(\frac{1}{2} \pi (t-1)\right),-b+r-r \sin \left(\frac{1}{2} \pi (t-1)\right)\right\} & 1

This varies the parameter $$t$$ over the range $$[0,8]$$. If a range of $$[0,2\pi]$$ is required then just apply a scaling factor: $$g(t)=f\left(\frac{4t}{\pi}\right)$$

Image $$(a=1,b=1,r=0.5)$$

Image $$(a=8,b=5,r=2)$$

• Ian, At first glance, pretty awesome work. I'm going to need a day to digest this, before accepting if that's okay? Is that a Matlab --> gif image? That -2rt characteristic blows me away with its simplicity. – zipzit Oct 8 '16 at 8:51
• The graphic is done in Mathematica. I can add extra images (with different parameters if you like them). – Ian Miller Oct 8 '16 at 9:28
• Your mention of the $2rt$ term highlighted a mistake in my method due to use $r=a/2=b/2$ in my test image. I've updated my answer. – Ian Miller Oct 8 '16 at 9:47
• I think for 4 < t < 5 the line should read { −𝑎, (𝑏−𝑟)(2𝑡−9) } – aferriss Feb 21 at 18:36
• @aferriss Thanks. fixed. – Ian Miller Feb 26 at 7:51