how to draw 3d hyperbola
Drawing a hyperboloid seems similar a reasonably straightforward chore. In a world where architects are accustomed to creating complicated, non-uniform, costless-course surfaces, the hyperboloid is a relatively regular shape. Information technology seems piddling. Already you've probably idea of iii ways to depict a hyperboloid. I can tell you: they are all incorrect.
For the past v years I've been drawing hyperboloids. Working as an banana to Mark Burry on Antoni Gaudí's Sagrada Família, I've drawn hyperboloids over and over. I've never quite managed to draw a totally accurate one in Rhino (often nosotros have to apply more sophisticated software like CATIA). My quest to draw the perfect hyperboloid has taken me progressively deeper into the geometry engine underlying NURBs based CAD programs like Rhino. Last month, I finally constitute a style to depict an authentic hyperboloid.
My hyperboloid cartoon method derives from the underlying mathematics of NURBs surfaces. Despite the reliance on NURBs in contemporary architecture, I've never read anything about this fundamental geometric formula, much less about how to manipulate this formula to depict accurate shapes. In this post I'll outline a number of methods for cartoon hyperboloids. In the process I'll expose the mechanisms of NURBs and show how you can take advantage of these formulas to draw mathematically accurate shapes.
one. An intuitive hyperboloid
A hyperboloid can be generated intuitively by taking a cylinder and twisting ane end. Twist tight enough and you'll get two cones meeting at a point. Twist gently and you'll get a shape somewhere between a cone and a cylinder: a hyperboloid. Depending on how y'all look at it, it is either a cylinder that flairs outwards or a cone that never quite comes to a point.
The hyperboloid is a doubly ruled surface. That is to say, for any betoken on the hyperboloid, 2 perfectly directly lines tin can be drawn on the surface passing through that point. This is the unique property of doubly ruled surfaces: although they are curved, you can always find a directly line on them.
Much of Gaudí's compages is composed of doubly ruled surfaces (hyperboloids, hyperbolic paraboloids, helicoids, and planes). Gaudí rarely wrote about his design methods, then we can't be certain as to why he favoured using doubly ruled surfaces. One possible reason is that the straight lines make the curves easy to specify. Different most other curved surfaces, the hyperboloid tin be communicated intuitively and without whatever drawings. All a bricklayer needs is the radius of the cylinder, the length, and the corporeality it is twisted. To verify the surface is correct, you can just run a ruler along the surface. This type of construction logic present in Gaudí'southward architecture always astounds me. At first glance, you encounter complicated curved surfaces, just if you look carefully in that location is an elegant rationale to his forms that make them possible to construct, even prior to the computer.
Most of my work for Mark Burry on Gaudí's Sagrada Família involves hyperboloids in some way. Even projects I've worked on exterior the Sagrada Família (all the same with Mark), such as the Responsive Acoustic Surface and the Fab Pod, are comprised of hyperboloids. I've milled hyperboloids from plywood, I've made them with spun metal, 3d printers, and plaster. On my 24th birthday, my girlfriend fabricated me a hyperboloid shaped cake. In this strange way, hyperboloids accept become a regular part of what I do.
While hyperboloids are piece of cake to explain, they are difficult to describe in Rhino. The easiest way to describe a hyperboloid is to follow the explanation I've given above. Draw ii offset circles (the two ends of the cylinder), twist one of the circles, draw a line between the circles, and create a revolved surface using that line. The code beneath shows how to do this. Unfortunately, you lot ofttimes stop up with weird artifacts at the neck of the hyperboloid (shown below). This has to do with how the revolved line skews the UV curves of the hyperboloid surface. The construction logic of the hyperboloid doesn't necessarily translate into the computer.
#Rhino Python lawmaking to make a twisted hyperboloid import scriptcontext import Rhino import math def get_hyperboloid(radius, twist, depth) : """ Create revolved surface from line between circles. """ peak = Rhino.Geometry.Point3d(0,0,depth) superlative = Rhino.Geometry.Plane(top, Rhino.Geometry.Vector3d.ZAxis) top = Rhino.Geometry.Circle(top, radius) lesser = Rhino.Geometry.Point3d(0,0,-depth) bottom = Rhino.Geometry.Plane(bottom, Rhino.Geometry.Vector3d.ZAxis) bottom = Rhino.Geometry.Circle(bottom, radius) p_top = top.PointAt(0) p_bottom = bottom.PointAt(twist) line = Rhino.Geometry.Line(p_top, p_bottom) axis = Rhino.Geometry.Line(Rhinoceros.Geometry.Point3d(0,0,0), Rhino.Geometry.Point3d(0,0,1)) hyperboloid = Rhinoceros.Geometry.RevSurface.Create(line, axis) return hyperboloid if __name__=="__main__": """ Generate and bake hyperboloid. """ hyperboloid = get_hyperboloid(2, 2, i) attributes = Rhino.DocObjects.ObjectAttributes() scriptcontext.doc.Objects.AddSurface(hyperboloid, attributes) scriptcontext.doc.Views.Redraw()
2. A mathematical hyperboloid
A hyperboloid can also be defined mathematically. The formula for a hyperboloid is:
Parameterised, the formula becomes:
Using this formula, nosotros can generate any bespeak on the hyperboloid. If nosotros generate enough points, we can create an interpolated surface through the points.
#Rhinoceros Python code to make an interpolated hyperboloid import scriptcontext import Rhino import math def get_hyperboloid(a, b, c, depth) : """ Create revolved surface from hyperbola. Calibration to match proportions of hyperboloid. """ detail_u = x detail_v = 10 pts = list() for u in range(int(detail_u)): for v in range(int(detail_v)): u_normal = ((depth * 2 * u / (detail_u - 1)) - depth) / c v_normal = 2 * math.pi * 5 / (detail_v) x = a * math.sqrt(1 + u_normal**2) * math.cos(v_normal) y = b * math.sqrt(i + u_normal**2) * math.sin(v_normal) z = c * u_normal p = Rhino.Geometry.Point3d(x, y, z) pts.append(p) hyperboloid = Rhino.Geometry.NurbsSurface.CreateThroughPoints(pts, detail_u, detail_v, three, iii, False, True) return hyperboloid if __name__=="__main__": """ Generate and broil hyperboloid. """ hyperbola = get_hyperboloid(one, two, i, vi) attributes = Rhino.DocObjects.ObjectAttributes() scriptcontext.doc.Objects.AddSurface(hyperbola, attributes) scriptcontext.physician.Views.Redraw()
For a number of years this was the method I used to describe hyperboloids. From a altitude it looks good, but if you examine the surface closely you lot'll discover some slight inaccuracies. The points are in the right place, but the parts in-between – the parts that were interpolated – are sometimes also flat or too bent. This is considering the interpolated curve is following the NURBs formula rather than the hyperboloid formula. The curve passes through all the points we defined but the curve is not following the mathematical formula we used.
The accuracy can be somewhat improved past increasing the number of points (which effectively reduces the distance of interpolation). Unfortunately, increasing the points also increases the computational complexity of the surface. At a certain density, the surfaces become unmanageable. This can exist somewhat mitigated by using fewer points in the flatter areas of the hyperboloid and more points in the curved section. Fifty-fifty then, the inaccuracy is simply reduced and never eliminated. There volition always exist problems with the surface.
3. A BIM hyperboloid
I got around the interpolation problem by bypassing the Rhino geometry engine and creating my own specially for hyperboloids. Rather than drawing the hyperboloids in Rhinoceros, I would store the shape of the hyperboloids in a spreadsheet. If I needed view the hyperboloids, I would draw them in Rhino, just if I needed to manipulate the hyperboloids, I would do it mathematically through code. For example, instead of relying on Rhino's intersection role to discover the junction between two hyperboloids, I would mathematically calculate where this intersection occurred based on the data from the spreadsheet. The results were perfect, the interface was clunky, and the mathematics was non-trivial. In my thesis I wrote about finding the intersections between hyperboloids on the Fab Pod, the equation looked like this:
4. A NURBs hyperboloid
Recently on the Sagrada Família we in one case over again ran into the problem with the accuracy of the hyperboloids in Rhino. I began investigating how Rhino drew native elements like circles, which didn't seem to endure from any interpolation problems. They were ever perfect. My initial assumption was that Rhino handled these native elements differently to other gratuitous-form NURBs curves. It seemed that Rhino was somehow using the formula for the circle instead of the NURBs formula. I was one-half-right. Rhinoceros does use the formula for the circle but simply via the NURBs formula. In other words, Rhino manipulates the inputs to the NURBs formula in such a way that it becomes the circle formula. On Wikipedia at that place is even an example of how to draw a perfect circle using NURBs.
The tabular array above gives the location for a ready of control points that define a circle. The NURBs curve loosely traces path of these points, getting pulled towards the weightier points and passing more directly past the lighter points. These points don't produce a free-form NURBs curve that approximates a circle; rather, when these precise values are entered into the NURBs formula, the NURBs formula becomes the formula for a circle. This is true of many analytic shapes. If you know the NURBs formula, you tin manipulate the input variables to transform the NURBs formula into everything from the formula for a circle to the formula for a hyperboloid.
As an instance, I'll show yous how to derive the points and weights needed to depict a hyperboloid using NURBs. Showtime you lot need to encounter the NURBs formula, which looks a fleck crazy:
Where:
- C is the point being calculated,
- u is the location of the calculated betoken,
- P is a control point,
- w is the respective weight,
- k is the number of control points,
- North is the b-spline ground function,
- And north is the degree of the curve.
The NURBs formula is a general version of the Bézier formula. If the points and weights of a Bézier curve are put into the NURBs formula, information technology will draw an identical shape. The only difference between NURBs curves and Bézier curves is that NURBs curves can accept additional knots (essentially kinks) whereas Bézier curves can simply depict continuous shapes. Y'all'll notice that the Bézier formula is therefore slightly more simple than the NURBs formula:
Where B is the Bernstein polynomial.
Since the hyperboloid is a continuous shape, the Bézier formula tin can be used to derive the points and weights needed to describe a hyperboloid. Earlier drawing the 3d hyperboloid, we volition first draw the 2d profile: a hyperbola. At that place is a hyperbola tool in Rhinoceros but at that place isn't any way to generate a hyperbola algorithmically. You could draw one using an interpolated curve, but as I've shown above, this will produce inaccurate results. The but way to draw a hyperbola accurately is to plow the formula for the Bézier curve into the formula for a hyperbola.
The hyperbola formula looks like this (notation that I'thousand drawing the hyperbola on the XZ plane but so the hyperbola lines up with the hyperboloid formula given above):
To turn the Bézier formula into the hyperbola formula, we offset demand to know the degree of bend. Hyperbolas are quadratic since the highest social club is two (everything is to the power of two). Based on the Bézier formula above, the Bernstein polynomial for a quadratic curve is:
These Bernstein polynomials tin can exist inputted into the Bézier formula, which results in:
All all of a sudden in that location are simply six unknowns in the Bézier formula: P0, P1, Ptwo, & their corresponding weights. We just have to find these six values such that the formula equals the hyperbola formula (see diagram above to go a sense for how these points chronicle to the hyperbola).
Ane property of Bézier curves is that the curve always passes through the get-go and end points. This means the weights of these points doesn't matter, and so we tin can set w0 and wii to i. This also means that P0 and Pii must be a indicate on the hyperbola. Using the hyperbola formula, and setting P0 at an arbitrary summit (h) on the z-centrality, P0 becomes:
Where h is the meridian of the hyperbola. For simplicity sake, we will make P2 the mirror image of P0:
The only variables outstanding are P1 and westward1. We know that P1 lies on the ten-axis, so Pane.z must equal aught. We also know that the ends of a Bézier bend are always tangential to the control points. In other words, the line between P1 and P0 is tangental to the hyperbola at P0.
The tangent of a hyperbola is:
Where:
- 10, z is the point on the tangent (Pane),
- and x', z' is the signal on the hyperbola we are computing the tangent for (P0).
Since P0 is a point on the hyperbola that P1 is tangental to, we can useP0 for x' & z'. And since P1 lies on the x-axis, Pi.z must exist zero. Therefore, all we demand to solve for is x. Putting these variables into the formula in a higher place and rearranging gives the location of P1 relative to P0:
All that is left to calculate is w1. Since the hyperbola is symmetrical, we know the hyperbola will intersect with the 10-axis at the apex of the curve (betoken q). Signal q lies on the x-centrality, so z=0 for signal q. Putting z=0 into the hyperbola formula gives the location of point q every bit:
Bespeak q is the centre of the hyperbola. In the Bézier formula, this occurs when u=0.five. Putting u=0.5 into the Bézier formula results in:
Simplifying and replacing the values we have calculated above (wo = 1, w1 = ii, P2 = P0 [which happens in the 10 dimension], and C(0.5) for q) gives:
Multiplying the denominator and numerator by two:
Rearranging:
And with that, we have all the variables for defining a hyperbola (P0, Pone, P2, due west0, w1, west2). Putting this all into Rhino Python, you end up with the code below.
#Rhino Python code to make an accurate hyperboloid import scriptcontext import Rhinoceros import math def get_hyperbola(a, c, h) : """ Draws a hyperbola on the XZ aeroplane, centred at 0,0,0. """ p0 = Rhino.Geometry.Point3d(0, 0, 0) p1 = Rhino.Geometry.Point3d(0, 0, 0) p2 = Rhino.Geometry.Point3d(0, 0, 0) q = Rhino.Geometry.Point3d(0, 0, 0) p0.X = math.sqrt(a**2 * (i + (h**2 / c**two))) p0.Z = h p1.X = (-ane * p0.Z**ii * a**2) / (c**two * p0.X) + p0.X p1.Z = 0 p2.X = p0.10 p2.Z = -h q.X = a q.Z = 0 w1 = (p0.Ten-q.Ten) / (q.X-p1.X) points = [p0, p1, p2] hyperbola = Rhinoceros.Geometry.NurbsCurve.Create(False, ii, points) hyperbola.Points.SetPoint(1, Rhino.Geometry.Point4d(p1.X, p1.Y, p1.Z, w1)) return hyperbola def get_hyperboloid(a, b, c, depth) : """ Create revolved surface from hyperbola. Calibration to lucifer proportions of hyperboloid. """ hyperbola = get_hyperbola(a, c, depth) axis = Rhinoceros.Geometry.Line(Rhino.Geometry.Point3d(0,0,0), Rhino.Geometry.Point3d(0,0,1)) hyperboloid = Rhino.Geometry.RevSurface.Create(hyperbola, centrality) y_factor = float(b) / float(a) calibration = Rhino.Geometry.Transform.Scale(Rhino.Geometry.Airplane.WorldXY, 1, y_factor, i) hyperboloid = hyperboloid.ToNurbsSurface() hyperboloid.Transform(scale) return hyperboloid if __name__=="__main__": """ Generate and broil hyperboloid. """ hyperboloid = get_hyperboloid(1, 2, one, vi) attributes = Rhinoceros.DocObjects.ObjectAttributes() scriptcontext.md.Objects.AddSurface(hyperboloid, attributes) scriptcontext.doctor.Views.Redraw()
This lawmaking produces the hyperboloid beneath. It is a hyperboloid defined by just 20-four control points, all weighted perfectly to requite an absolutely precise hyperboloid. The geometry is lightweight, accurate, and splits cleanly with ruled lines. It has taken me a long time to become to this phase, just I finally feel like I understand – and can therefore command – the equations underlying software like Rhino. Hopefully this post has given you some insight into the underlying equations of CAD software and how they can be manipulated. And if non, hopefully y'all've at least learnt the many ways to describe a hyperboloid.
All code in this post licensed under Creative Commons attribution.
Source: https://www.danieldavis.com/how-to-draw-a-hyperboloid/
0 Response to "how to draw 3d hyperbola"
Post a Comment