how to draw 3d curve in origin
iii Parametric Curves and Surfaces
This guide is an in-depth review of parametric curves with special focus on NURBS curves and the concepts of continuity and curvature.
Suppose you travel every weekday from your house to your work. You get out at eight:00 in the morn and arrive at 9:00. At each point in time between 8:00 and 9:00, y'all would be at some location along the manner. If you plot your location every minute during your trip, you tin can define the path between home and work by connecting the 60 points you plotted. Assuming y'all travel the verbal same speed every twenty-four hours, at 8:00 you would be at dwelling (start location), at 9:00 y'all would be at work (cease location) and at eight:40 you would at the exact same location on the path as the 40th plot point. Congratulations, you have just divers your first parametric bend! You have used fourth dimension as a parameter to define your path, and hence y'all can call your path curve a parametric bend. The time interval you spend from offset to finish (eight to 9) is called the curve domain or interval.
In general, we can describe the \(x\), \(y\), and \(z\) location of a parametric curve in terms of some parameter \(t\) as follows:
\(x = 10(t)\)
\(y = y(t)\)
\(z = z(t)\)
Where:
\(t\) is a range of real numbers
Nosotros saw earlier that the parametric equation of a line in terms of parameter \(t\) is divers every bit:
\(x = ten' + t * a\)
\(y = y' + t * b\)
\(z = z' + t * c\)
Where:
\(10\), \(y\), and \(z\) are functions of t where t represents a range of real numbers. \(x'\), \(y'\), and \(z'\) are the coordinates of a point on the line segment. \(a\), \(b\), and \(c\) define the slope of the line, such that the vector \(\mathbf{\vec v} <a, b, c>\) is parallel to the line.
Nosotros can therefore write the parametric equation of a line segment using a \(t\) parameter that ranges between two existent number values \(t0\), \(t1\) and a unit vector \(\mathbf{\vec v}\) that is in the direction of the line equally follows:
\(P = P' + t * \mathbf{\vec five}\)
Another case is a circle. The parametric equation of the circumvolve on the xy-aeroplane with a eye at the origin (0,0) and an angle parameter \(t\) ranging between \(0\) and \(2π\) radians is:
\(x = r \dot cos(t)\)
\(y = r \dot sin(t)\)
We can derive the general equation of a circle for the parametric one every bit follows:
\(10/r = cos(t)\)
\(y/r = sin(t)\)
And since:
\(cos(t)^2 + sin(t)^2 = 1\) (Pythagorean identity)
And then:
\((ten/r)^ii + (y/r)^two = ane\) , or
\(x^2 + y^2 = r^2\)
3.1 Parametric curves
Curve parameter
A parameter on a bend represents the address of a point on that curve. Every bit mentioned earlier, you can retrieve of a parametric curve as a path traveled between 2 points in a sure amount of time, traveling at a fixed or variable speed. If traveling takes \(T\) amount of time, and then the parameter t represents a time inside \(T\) that translates to a location (point) on the curve.
If you accept a direct path (line segment) between the two points \(A\) and \(B\), and \(\mathbf{\vec v}\) were a vector from \(A\) to \(B\) (\(\mathbf{\vec five} = B - A\)), then y'all can apply the parametric line equation to find all points \(Yard\) betwixt \(A\) and \(B\) as follows:
\(M = A + t*(B-A)\)
Where:
\(t\) is a value between 0 and i.
The range of t values, 0 to i in this case, is referred to every bit the bend domain or interval. If t was a value outside the domain (less that 0 or more than than 1), then the resulting point \(M\) will be outside the linear bend \(\overline{AB}\).
The same principle applies for any parametric curve. Any point on the curve can be calculated using the parameter t within the interval or domain of values that define the limits of the curve. The beginning parameter of the domain is ordinarily referred to as \(t0\) and the stop of the domain as \(t1\).
Curve domain or interval
A curve domain or interval is divers as the range of parameters that evaluate into a point within that curve. The domain is usually described with two real numbers defining the domain limits expressed in the class (min to max)or (min, max). The domain limits tin exist whatsoever two values that may or may not be related to the actual length of the curve. In an increasing domain, the domain min parameter evaluates to the start signal of the curve and the domain max evaluates to the cease indicate ofthe bend.
Changing a bend domain is referred to as the procedure of reparameterizing the curve. For example, it is very mutual to change the domain to be (0 to 1). Reparameterizing a curve does not affect the shape of the 3-D curve. It is like changing the travel time on a path by running instead of walking, which does not change the shape of the path.
An increasing domain means that the minimum value of the domain points to the start of the bend. Domains are typically increasing, simply not always.
Curve evaluation
We learned that a bend interval is the range of all parameter values that evaluate to points within the 3-D bend. There is, however, no guarantee that evaluating at the eye of the domain, for example, will give a indicate that is in the middle of the curve, equally shown in Figure (29).
We can remember of uniform parameterization of a curve every bit traveling a path with constant speed. A degree-one line betwixt two points is one example where equal intervals or parameters translate into equal intervals of arc length on the line. This is a special example where equal intervals of parameters evaluate to equal intervals on the iii-D bend.
It is, however, more than likely that the speed decreases or increases along the path. For example, if it takes xxx minutes to travel a road, information technology is unlikely that you will be exactly one-half way through at minute xv. Figure (xxx) shows a typical example where equal parameter intervals evaluate to variable length on the three-D curve.
You may need to evaluate points on a three-D curve that are at a divers per centum of the curve length. For example, yous might need to divide the curve into equal lengths. Typically, iii-D modelers provide tools to evaluate curves relative to arc length.
Tangent vector to a bend
A tangent to a curve at any parameter (or point on a curve) is the vector that touches the curve at that point, just does not cross over. The gradient of the tangent vector equals the gradient of the curve at the same bespeak. The following example evaluates the tangent to a bend at two different parameters.
Cubic polynomial curves
Hermite and Bézier curves are ii examples of cubic polynomial curves that are determined past four parameters. A Hermite bend is determined by two end points and two tangent vectors at these points, while a Bézier curve is divers by four points. While they differ mathematically, they share similar characteristics and limitations.
In most cases, curves are made out of multiple segments. This requires making what is called a piecewise cubic curve. Here is an illustration of a piecewise Bézier bend that uses vii storage points to create a two-segment cubic bend. Notation that although the final bend is joined, information technology does not wait smooth or continuous.
Although Hermite curves utilize the same number of parameters equally Bézier curves (four parameters to ascertain 1 curve), they offer the boosted information of the tangent curve that tin can also exist shared with the next piece to create a smoother looking bend with less total storage, as shown in the following.
The not-uniform rational B-spline (NURBS) is a powerful curve representation that maintains even smoother and more continuous curves. Segments share more control points to achieve even smoother curves with less storage.
NURBS curves and surfaces are the main mathematical representation used past Rhino to represent geometry. NURBS curve characteristics and components will exist covered with some detail later in this chapter.
Evaluating cubic Bézier curves
Named after its inventor, Paul de Casteljau, the de Casteljau algorithm evaluates Bézier curves using a recursive method. The algorithm steps can exist summarized as follows:
Input:
Four points \(A\), \(B\), \(C\), \(D\) ascertain a curve \(t\), is any parameter inside bend domain
Output:
Point \(R\) on bend that is at parameter \(t\).
Solution:
- Observe indicate \(M\) at \(t\) parameter on line \(\overline{AB}\).
2.Find point \(Due north\) at \(t\) parameter on line \(\overline{BC}\).
iii.Notice bespeak \(O\) at \(t\) parameter on line \(\overline{CD}\).
4.Find point \(P\) at \(t\) parameter on line \(\overline{MN}\).
5.Find point \(Q\) at \(t\) parameter on line \(\overline{NO}\).
half dozen.Discover point \(R\) at \(t\) parameter on line \(\overline{PQ}\).
3.two NURBS curves
NURBS is an accurate mathematical representation of curves that is highly intuitive to edit. It is easy to represent free-form curves using NURBS and the control structure makes it piece of cake and predictable to edit.
At that place are many books and references for those of you interested in an in-depth reading about NURBS. A basic agreement of NURBS is however necessary to aid use a NURBS modeler more effectively. There are iv main attributes define the NURBS curve: degree, command points, knots, and evaluation rules.
- Wikipedia: De Boor's algorithm
- Michigan Tech, Department of Informatics, De Boor'due south algorithm
Degree
Curve caste is a whole positive number. Rhino allows working with whatever degree curve starting with 1. Degrees one, 2, 3, and five are the most useful but the degrees four and those above v are not used much in the real globe. Post-obit are a few examples of curves and their degree:
Command points
The control points of a NURBS curve is a list of at to the lowest degree (degree+one) points. The near intuitive way to change the shape of a NURBS bend is through moving its control points.
The number of control points that impact each span in a NURBS bend is defined by the caste of the curve. For example, each span in a degree-1 bend is affected merely past the two cease control points. In a degree-ii curve, three control points bear on each span and then on.
Weights of control points
Each control betoken has an associated number chosen weight. With a few exceptions, weights are positive numbers. When all control points take the same weight, unremarkably 1, the curve is called non-rational. Intuitively, you can call back of weights as the amount of gravity each control point has. The higher the relative weight a control point has, the closer the bend is pulled towards that command bespeak.
It is worth noting that it is best to avoid irresolute curve weights. Changing weights rarely gives desired upshot while it introduces a lot of adding challenges in operations such as intersections. The only expert reason for using rational curves is to represent curves that cannot otherwise be drawn, such as circles and ellipses.
Scaling a knot list does not affect the 3D bend. If you lot change the domain of the bend in the above example from "0 to iv" to "0 to 1", knot list become scaled, just the 3D curve does not change.
Knots
Each NURBS curve has a list of numbers associated with it chosen a list of knots (sometimes referred to as knot vector). Knots are a little harder to understand and set. While using a iii-D modeler, you volition not need to manually set the knots for each curve you create; a few things will be useful to learn about knots.
Knots are parameter values
Knots are a non-decreasing list of parameter values that lie within the curve domain. In Rhinoceros, there is caste-1 more knots than control points. That is the number of knots equals the number of control points plus bend degree minus 1:
Usually, for non-periodic curves, the first caste many knots are equal to the domain minimum, and the last degree many knots are equal to the domain maximum.
For instance, the knots of an open up degree-3 NURBS curve with 7 control points and a domain betwixt 0 and 4 may expect like <0, 0, 0, one, 2, 3, 4, four, four>.
Knot multiplicity
The multiplicity of a knot is the number of times it is listed in the listing of knots. The multiplicity of a knot cannot be more than the caste of the curve. Knot multiplicity is used to control continuity at the corresponding curve bespeak.
Fully-multiple knots
A fully multiple knot has multiplicity equal to the curve degree. At a fully multiple knot there is a respective control point, and the curve goes through this point.
For example, clamped or open curves have knots with full multiplicity at the ends of the bend. This is why the cease control points coincide with the curve end points. Interior fully multiple knots allow a kink in the bend at the corresponding indicate.
Uncomplicated knot
A unproblematic knot is 1 with value actualization merely once. Interior knots are typically simple.
Uniform knots
A compatible list of knots satisfies the following condition.
Knots offset with a fully-multiple knot, are followed by simple knots, and cease with a fully-multiple knot. The values are increasing and equally spaced. This is typical of clamped or open up curves. Periodic curves work differently equally we will run across later.
Here are two curves that have the aforementioned number and location of command points, and yet have different knots and curve shape:
Caste = 3 Number of command points = 7 knots = <0,0,0,1,2,3,four,four,iv> = 9 knots Domain (0 to 4) | |
Degree = 3 Number of control points = 7 knots = <0,0,0,one,1,i,4,4,four> = nine knots Domain (0 to 4) Notation: A fully multiple knot in the middle creates a kink and the bend is forced to go through the associated control bespeak. |
Evaluation rule
The evaluation dominion uses a mathematical formula that takes a number inside the curve domain and assigns a point. The formula takes into business relationship the degree, control points, and knots.
Using this formula, specialized curve functions can accept a curve parameter and produce the respective point on that bend. A parameter is a number that lies within the curve domain. Domains are usually increasing and consist of two numbers: the minimum domain parameter \(t(0)\) that evaluates to the start point of the curve and the maximum \(t(1)\) that evaluates to the end point of the bend.
Characteristics of NURBS curves
In order tocreate a NURBS curve, yous will demand to provide the followinginformation:
- Dimension, typically 3
- Degree, (sometimes employ the society,which is equal to degree+1)
- Control points (list of points)
- Weight of the control point (listof numbers)
- Knots (list of numbers)
When you create a curve, you need to at least define the degree and locations of the control points. The residuum of the information necessary to construct NURBS curves tin can be generated automatically. Selecting an end point to coincide with the first point would typically create a periodic smooth closed bend. The following table shows examples of open and closed curves:
Degree-1 open curve. The curve goes through all control points. | |
Degree-3 open up curve. Both curve ends coincide with end control points. | |
Degree-3 closed periodic curve. The curve seam does non go through a control point. | |
Moving command points of a periodic curve does not affect curve smoothness. | |
Kinks are created when the curve is forced through some control points. | |
Moving the control points of a non-periodic bend does not guarantee shine continuity of the curve, but enables more control over the outcome. |
Clamped vs. periodic NURBS curves
The stop points of closed clamped curves coincide with end control points. Periodic curves are smoothen airtight curves. The best way to sympathize the differences between the two is through comparing control points and knots.
The following is an case of an open, clamped not-rational NURBS bend. This curve has four control points, uniform knots with total-multiplicity at the start and end knots and the weights of all control points equal to 1.
The following circular curve is an example of a degree-3 closed periodic NURBS curve. It is also non-rational considering all weights are equal. Note that periodic curves require more than command points with few overlapping. Also the knots are simple.
Notice that the periodic curve turned the four input points into seven command points (caste+4), while the clamped bend used only the four command points. The knots of the periodic curve uses only simple knots, while the clamped curve start and finish knots have full multiplicity forcing the curve to go through the start and end control points.
If nosotros set the caste of the previous examples to 2 instead of iii, the knots become smaller, and the number of command points of periodic curves changes.
Weights
Weights of control points in a compatible NURBS bend are prepare to 1, just this number can vary in rational NURBS curves. The following example shows the outcome of varying the weights of control points.
Evaluating NURBS curves
Named after its inventor, Carl de Churl, the de Churl'due south algorithmi is a generalization of the de Casteljau algorithm for Bézier curves. It is numerically stable and is widely used to evaluate points on NURBS curves in three-D applications. The following is an example for evaluating a point on a degree-iii NURBS curve using de Boor'south algorithm.
Input:
Seven command points \(P0\) to \(P6\)
Knots:
\(u_0 = 0.0\)
\(u_1 = 0.0\)
\(u_2 = 0.0\)
\(u_3= 0.25\)
\(u_4 = 0.5\)
\(u_5 = 0.75\)
\(u_6 = 1.0\)
\(u_7 = 1.0\)
\(u_8 = i.0\)
Output:
Point on curve that is at \(u=0.4\)
Solution:
1. Calculate coefficients for the commencement iteration:
\(A_c = ((u – u_1)/(u_{1+iii} – u_1) = 0.8\)
\(B_c = (u – u_2)/(u_{2+iii} – u_2) = 0.53\)
\(C_c = (u – u_3)/(u_{3+3} – u_3) = 0.2\)
2. Summate points using coefficient data:
\(A = 0.2P_1 + 0.8P_2\)
\(B = 0.47 P_2 + 0.53 P_3\)
\(C = 0.8 P_3 + 0.2 P_4\)
3. Calculate coefficients for the second iteration:
\(D_c = (u – u_2) / (u_{two+3-one} – u_2) = 0.8\)
\(E_c = (u – u_3) / (u_{3+3-1} – u_3) = 0.3\)
4. Calculate points using coefficient data:
\(D = 0.2A+ 0.8B\)
\(Eastward = 0.7B + 0.3C\)
5. Summate the last coefficient:
\(Fc = (u – u_3)/ (u_{iii+three-ii} – u_3) = 0.vi\)
Find the point on curve at \(u=0.4\) parameter:
\(F= 0.4D + 0.6E\)
3.3 Curve geometric continuity
Continuity is an important concept in 3‑D modeling. Continuity is important for achieving visual smoothness and for obtaining smooth light and airflow. The following tabular array shows various continuities and their definitions:
G0 | (Position continuous) | 2 curve segments joined together |
G1 | (Tangent continuous) | Direction of tangent at joint point is the aforementioned for both curve segments. |
G2 | ( Curvature Continuous) | Curvatures as well every bit tangents agree for both bend segments at the common endpoint. |
GN | ……. | The curves agree to college order |
3.4 Curve curvature
Curvature is a widely used concept in modeling iii‑D curves and surfaces. Curvature is defined every bit the change in inclination of a tangent to a curve over unit length of arc. For a circle or sphere, it is the reciprocal of the radius and it is abiding beyond the full domain.
At any point on a curve in the plane, the line best approximating the curve that passes through this point is the tangent line. We can likewise find the best approximating circle that passes through this point and is tangent to the bend. The reciprocal of the radius of this circle is the curvature of the curve at this point.
The best approximating circumvolve can lie either to the left or to the right of the curve. If nosotros care virtually this, we found a convention, such as giving the curvature positive sign if the circle lies to the left and negative sign if the circle lies to the right of the bend. This is known as signed curvature. Curvature values of joined curves indicate continuity betwixt these curves.
3.5 Parametric surfaces
Surface parameters
A parametric surface is a function of two independent parameters (usually denoted \(u\), \(v\)) over some two-dimensional domain. Accept for instance a plane. If nosotros have a point \(P\) on the plane and 2 nonparallel vectors on the plane, \(\vec a\) and \(\vec b\), so we tin define a parametric equation of the plane in terms of the two parameters \(u\) and \(5\) as follows:
\(P = P' + u * \mathbf{\vec a} + v * \mathbf{\vec b}\)
Where:
\(P'\): is a known point on the plane
\(\mathbf{\vec a}\): is the beginning vector on the plane
\(\mathbf{\vec b}\): is the first vector on the plane
\(u\): is the get-go parameter
\(v\): is the commencement parameter
Some other example is the sphere. The Cartesian equation of a sphere centered at the origin with radius \(R\) is
\(ten^2 + y^2 + z^two = R^2\)
That means for each signal, there are 3 variables (\(10\), \(y\), \(z\)), which is non useful to use for a parametric representation that requires only ii variables. Even so, in the spherical coordinate system, each point is establish using the three values:
\(r\): radial distance between the point and the origin
\(θ\): the angle from the 10-centrality in the xy-airplane
\(ø\): the bending from the z-centrality and the bespeak
A conversion of points from spherical to Cartesian coordinate can exist obtained as follows:
\(x = r * sin(ø) * cos(θ)\)
\(y = r * sin(ø) * sin(θ)\)
\(z = r * cos (ø)\)
Where:
\(r\) is distance from origin \(≥ 0\)
\(θ\) is running from \(0\) to \(2π\)
\(ø\) is running from \(0\) to \(π\)
Since \(r\) is constant in a sphere surface, we are left with only two variables, and hence we can use the to a higher place to create a parametric representation of a sphere surface:
\(u = θ\)
\(five = ø\)
So that:
\(x = r * sin(five) * cos(u)\)
\(y = r * sin(v) * sin(u)\)
\(z = r * cos(v)\)
Where (\(u\), \(five\)) is inside the domain (\(2 π\), \(π\))
The parametric surface follows the full general form:
\(x = x(u,5)\)
\(y = y(u,v)\)
\(z = z(u,v)\)
Where:
\(u\) and \(v\) are the ii parameters within the surface domain or region.
Surface domain
A surface domain is defined as therange of (\(u,v\)) parameters that evaluate into a iii D indicate on thatsurface. The domain in each dimension (\(u\) or \(v\)) is usually describedas two existent numbers (\(u_{min}\) to \(u_{max}\)) and (\(v_{min}\) to \(v_{max}\))
Changing a surface domain is referredto every bit reparameterizing the surface. An increasingdomain means that the minimum value of the domain points to theminimum point of the surface. Domains are typically increasing, butnot always.
Surface evaluation
Evaluating a surface at a parameter that is within the surface domain results in a point that is on the surface. Keep in listen that the heart of the domain (\(u_{mid}\), \(v_{mid}\)) might not necessarily evaluate to the middle point of the 3-D surface. Also, evaluating \(u-\) and \(v-\) values that are outside the surface domain will not give a useful result.
Tangent plane of a surface
The tangent plane to a surface at a given point is the plane that touches the surface at that betoken. The z-direction of the tangent airplane represents the normal direction of the surface at that point.
3.six Surface geometric continuity
Many models cannot be constructed from one surface patch. Continuity between joined surface patches is of import for visual smoothness, low-cal reflection, and airflow. The following table shows various continuities and their definitions:
G0 | (Position continuous) | Ii surfaces joined together. |
G1 | (Tangent continuous) | The respective tangents of the ii surfaces forth their joint border are parallel in both u‑ and v‑directions. |
G2 | ( Curvature Continuous) | Curvatures also every bit tangents agree for both surfaces at the common edge. |
GN | ……. | The surfaces concur to higher social club. |
3.7 Surface curvature
For surfaces, normal curvature is one generalization of curvature to surfaces. Given a signal on the surface and a direction lying in the tangent plane of the surface at that point, the normal department curvature is computed past intersecting the surface with the plane spanned past the point, the normal to the surface at that indicate, and the management. The normal section curvature is the signed curvature of this bend at the betoken of involvement.
If we look at all directions in the tangent plane to the surface at our point, and we compute the normal curvature in all these directions, there will exist a maximum value and a minimum value.
Master curvatures
The chief curvatures of a surface at a bespeak are the minimum and maximum of the normal curvatures at that point. They measure the maximum and minimum bend amount of the surface at that betoken. The principal curvatures are used to compute the Gaussian and mean curvatures of the surface.
For instance, in a cylindrical surface, in that location is no bend along the linear direction (curvature equals nada) while the maximum bend is when intersecting with a plane parallel to the end faces (curvature equals 1/radius). Those ii extremes make the principle curvatures of that surface.
Gaussian curvature
The Gaussian curvature of a surface at a indicate is the product of the principal curvatures at that point. The tangent plane of any point with positive Gaussian curvature touches the surface locally at a single point, whereas the tangent plane of any betoken with negative Gaussian curvature cuts the surface.
A: Positive curvature when surface is basin-like.
B: Negative curvature when surface is saddle-like.
C: Zero curvature when surface is flat in at to the lowest degree one direction (aeroplane, cylinder).
Hateful curvature
The hateful curvature of a surface at a betoken is one-one-half of the sums of the primary curvatures at that betoken. Any point with naught mean curvature has negative or zip Gaussian curvature.
Surfaces with zero mean curvature everywhere are minimal surfaces. Concrete processes which can be modeled by minimal surfaces include the formation of lather films spanning fixed objects, such as wire loops. A lather motion-picture show is not distorted by air pressure (which is equal on both sides) and is free to minimize its area. This contrasts with a soap bubble, which encloses a fixed quantity of air and has unequal pressures on its inside and exterior. Mean curvature is useful for finding areas of abrupt change in the surface curvature.
Surfaces with constant mean curvature everywhere are often referred to equally constant mean curvature (CMC) surfaces. CMC surfaces include the formation of soap bubbles, both gratis and attached to objects. A soap bubble, unlike a unproblematic soap film, encloses a book and exists in equilibrium where slightly greater pressure level inside the chimera is counterbalanced by the area-minimizing forces of the bubble itself.
iii.8 NURBS surfaces
You can call up of NURBS surfaces as a grid of NURBS curves that go in two directions. The shape of a NURBS surface is defined by a number of control points and the degree of that surface in each ane of the two directions (u- and v-directions). NURBS surfaces are efficient for storing and representing gratuitous-course surfaces with a high degree of accuracy. The mathematical equations and details of NURBS surfaces are beyond the scope of this text. We will only focus on the characteristics that are well-nigh useful for designers.
Evaluating parameters at equal intervals in the 2-D parameter rectangle does not translate into equal intervals in 3-D space in nearly cases.
Characteristics of NURBS surfaces
NURBS surface characteristics are very similar to NURBS curves except at that place is one boosted parameter. NURBS surfaces hold the following information:
- Dimension, typically 3
- Degree in u‑and 5‑directions: (sometimes use order which is caste + one)
- Control points (points)
- Weights of control points (numbers)
- Knots (numbers)
As with the NURBS curves, you lot volition probably not need to know the details of how to create a NURBS surface, since 3-D modelers will typically provide proficient prepare of tools for this. You tin can always rebuild surfaces (and curves for that matter) to a new degree and number of control points. Surface can be open up, closed, or periodic. Hither are few examples of surfaces:
Caste-1 surface in both u- and 5-directions. All control points lie on the surface. | |
Caste-3 in the u-direction and degree‑1 in the five-direction open surface. The surface corners coincide with corner control points. | |
Degree-3 in the u-direction and degree one in the 5-management closed (not-periodic) surface. Some command points coincide with the surface seam. | |
Moving command points of a closed (non-periodic) surface causes a kink and the surface does not look smooth. | |
Degree 3 the u-direction and degree 1 in the v-direction periodic surface. The surface control points do not coincide with the surface seam. | |
Moving the control points of a periodic surface does not touch on surface smoothness or create kinks. |
Singularity in NURBS surfaces
For instance, if y'all accept a linear edge of a simple aeroplane, and you drag the 2 end control points of an edge so they overlap (collapse) at the heart, yous volition get a singular edge. You will notice that the surface isocurves converge at the singular point.
The above triangular shape can be created without singularity. You lot can trim a surface with a triangle polyline. When you examine the underlying NURBS structure, you see that it remains a rectangular shape.
Other common examples of surfaces that are hard to generate without singularity are the cone and the sphere. The peak of a cone and top and bottom edges of a sphere are collapsed into one point. Whether there is singularity or not, the parameter rectangle maintains a more or less rectangular region.
Trimmed NURBS surfaces
NURBS surfaces tin can be trimmed or untrimmed. Trimmed surfaces use an underlying NURBS surface and closed curves to trim out part of that surface. Each surface has 1 airtight curve that defines the outer border (outer loop) and can have non-intersecting closed inner curves to define holes (inner loops). A surface with an outer loop that is the aforementioned as that of its underlying NURBS surface and that has no holes is what we refer to equally an untrimmed surface.
3.nine Polysurfaces
A polysurface consists of two or more than(possibly trimmed) NURBS surfaces joined together. Each surface hasits ain structure, parameterization, and isocurve directions that donot take to match. Polysurfaces are represented using the boundaryrepresentation (BRep). The BRep structure describes surfaces,edges, and vertices with trimming data and connectivity amongdifferent parts. Trimmed surface are besides represented using BRep datastructure.
The BRep is a data construction that describes each face in terms of its underlying surface, surrounding 3-D edges, vertices, parameter space two-D trims, and relationship between neighboring faces. BRep objects are too called solids when they are closed (watertight).
An case polysurface is a simple box that is fabricated out of 6 untrimmed surfaces joined together.
The aforementioned box can be made using trimmed surfaces, such as the top ane in the post-obit case.
The top and bottom faces of the cylinder in the post-obit instance are trimmed from planar surfaces.
Nosotros saw that editing NURBS curves and untrimmed surfaces is intuitive and can be washed interactively past moving control points. Yet, editing trimmed surfaces and polysurfaces can be challenging. The main challenge is to exist able to maintain joined edges of different faces inside the desired tolerance. Neighboring faces that share common edges can be trimmed and practise not usually have matching NURBS structure, and therefore modifying the object in a way that deforms that common border might result in a gap.
Another challenge is that there is typically less command over the outcome, especially when modifying trimmed geometry.
Trimmed surfaces are described in parameter space using the untrimmed underlying surface combined with the 2-D trim curves that evaluate to the 3-D edges within the 3-D surface.
3.x Tutorials
The following tutorials apply the concepts learned in this affiliate. They utilise Rhinoceros 5 and Grasshopper 0.9.
iii.10.1 Continuity between curves
Examine the continuity between two input curves. Continuity assumes that the curves meet at the end of the offset bend and the start of the second curve.
Input:
2 input curves.
Parameters:
Summate the following to be able to determine the continuity between two curves:
- The finish signal of the outset curve (\(P1\))
- The first point of the second curve (\(P2\))
- The tangent at the terminate of the showtime curve and at the start of the 2nd curve (\(T1\) and \(T2\)).
- The curvature at the end of the first bend and at the start of the second curve (\(C1\) and \(C2\)).
Solution:
1. Reparameterize the input curves. We do that then that nosotros know that the start of the curve evaluates at \(t=0\) and the end at \(t=one\).
2. Extract the end and outset points of the ii curves, and check whether they coincide. If they do, the two curves are at least \(G0\) continuous.
3. Calculate tangents.
four. Compare the tangents using the dot product. Brand certain to unitize vectors. If the curves are parallel, then we have at least \(G1\) continuity.
5. Calculate curvature vectors.
6. Compare curvature vectors, and if they agree, the two curves are \(G2\) continuous.
seven. Create logic that filters through the three results (G1, G2, and G3) and select the highest continuity.
Using the Grasshopper VBScript component:
Private Sub RunScript(ByVal c1 As Curve, ByVal c2 As Curve, ByRef A As Object) 'declare variables Dim continuity As New String("") Dim t1, t2 As Double Dim v_c1, v_c2, c_c1, c_c2 As Vector3d 'extract start and finish points Dim end_c1 = c1.PointAtEnd Dim start_c2 = c2.PointAtStart 'cheque G0 continuity If end_c1.DistanceTo(start_c2) = 0 Then continuity = "G0" End If 'check G1 continuity If continuity = "G0" And so 'calculate tangents v_c1 = c1.TangentAtEnd v_c2 = c2.TangentAtStart 'unitize tangent vectors v_c1.Unitize v_c2.Unitize 'compare tangents If v_c1 * v_c2 = 1.0 And then continuity = "G1" End If End If 'check G2 continuity If continuity = "G1" So 'extract the parameter at start and terminate of the curves domain t1 = c1.Domain.Max t2 = c2.Domain.Min 'summate curvature c_c1 = c1.CurvatureAt(t1) c_c2 = c2.CurvatureAt(t2) 'unitize curvature vectors c_c1.Unitize c_c2.Unitize 'compare vectors If c_c1 * c_c2 = one.0 Then continuity = "G2" Finish If End If 'Assign output A = continuity End Sub
Using the Grasshopper Python component:
#decclare variables continuity = "" #extract beginning and end points end_c1 = c1.PointAtEnd start_c2 = c2.PointAtStart #check G0 continuity if end_c1.DistanceTo(start_c2) == 0: continuity = "G0" #cheque G1 continuity if continuity == "G0": #calculate tangents v_c1 = c1.TangentAtEnd v_c2 = c2.TangentAtStart #unitize tangent vectors v_c1.Unitize() v_c2.Unitize() #compare tangents dot = v_c1 * v_c2 if dot == i.0: continuity = "G1" else: print("Failed G1") print(dot) #cheque G2 continuity if continuity == "G1": #excerpt the parameter at start and end of the curves domain t1 = c1.Domain.Max t2 = c2.Domain.Min #calculate curvature c_c1 = c1.CurvatureAt(t1) c_c2 = c2.CurvatureAt(t2) #unitize curvature vectors c_c1.Unitize() c_c2.Unitize() #compare vectors dot = c_c1 * c_c2 if dot == 1.0: continuity = "G2" else: print("Failed G2") print(dot) #assign output A = continuity
Using the Grasshopper C# component:
Private Sub RunScript(ByVal c1 As Curve, ByVal c2 Every bit Curve, ByRef A As Object) 'declare variables Dim continuity As New String("") Dim t1, t2 Every bit Double Dim v_c1, v_c2, c_c1, c_c2 As Vector3d 'extract start and stop points Dim end_c1 = c1.PointAtEnd Dim start_c2 = c2.PointAtStart 'check G0 continuity If end_c1.DistanceTo(start_c2) = 0 Then continuity = "G0" Cease If 'cheque G1 continuity If continuity = "G0" Then 'calculate tangents v_c1 = c1.TangentAtEnd v_c2 = c2.TangentAtStart 'unitize tangent vectors v_c1.Unitize v_c2.Unitize 'compare tangents If v_c1 * v_c2 = i.0 And so continuity = "G1" Stop If Finish If 'bank check G2 continuity If continuity = "G1" Then 'excerpt the parameter at start and finish of the curves domain t1 = c1.Domain.Max t2 = c2.Domain.Min 'calculate curvature c_c1 = c1.CurvatureAt(t1) c_c2 = c2.CurvatureAt(t2) 'unitize curvature vectors c_c1.Unitize c_c2.Unitize 'compare vectors If c_c1 * c_c2 = one.0 Then continuity = "G2" End If Cease If 'Assign output A = continuity End Sub
3.x.ii Surfaces with singularity
Extract atypical points in a sphere and a cone.
Input:
One sphere and 1 cone.
Parameters:
Singularity tin be detected through analyzing the ii-D parameter space trims that have invalid or zero-length corresponding edges. Those trims ought to be singular.
Solution:
- Traverse through all trims in the input.
- Check if any trim has an invalid edge and flag information technology equally a singular trim.
- Extract betoken locations in 3-D space.
Using the Grasshopper VB component:
Individual Sub RunScript(ByVal srf Every bit Brep, ByRef A As Object) 'Decalre a new list of points Dim singular_points As New Listing( Of Point3d) 'Examine all trims in the input For Each trim As BrepTrim In srf.Trims 'Zippo edge of a trim indicates a singularity If trim.Border Is Nothing Then 'Find the 2D parameter space betoken of the commencement or end of the trim Dim pt2d = New Point2d(trim.PointAtStart) 'Evaluate trim finish point on the object surface Dim pt3d = trim.Face.PointAt(pt2d.x, pt2d.y) 'Add 3D betoken to the listing of singular points singular_points.Add(pt3d) Finish If Next 'Asign output A = singular_points Cease Sub
Using the Grasshopper Python component:
#Decalre a new list of points singular_points = [] #Examine all trims in the input brep for trim in srf.Trims: #Null edge of a trim indicates a singularity if trim.Border == None: #Discover the second parameter infinite point at trim start or end pt2d = trim.PointAtStart #Evaluate trim finish point on the object surface pt3d = trim.Face.PointAt(pt2d.Ten, pt2d.Y) #Add 3D point to the list of singular points singular_points.suspend(pt3d) #Asign output A = singular_points
Using the Grasshopper C# component:
private void RunScript(Brep srf, ref object A) { //Decalre a new list of points List < Point3d > singular_points = new List<Point3d>(); //Examine all trims in the input foreach( BrepTrim trim in srf.Trims) { //Null edge of a trim indicates a singularity if( trim.Edge == naught) { //Find the 2D parameter space point of the beginning or finish of the trim Point2d pt2d = new Point2d(trim.PointAtStart); //Evaluate trim finish indicate on the object surface Point3d pt3d = trim.Face.PointAt(pt2d.X, pt2d.Y); //Add 3D point to the list of atypical points singular_points.Add(pt3d); } } //Asign output A = singular_points }
Download Sample Files
Download the math-samplesandtutorials.zip archive, containing all the example Grasshopper and lawmaking files in this guide.
Next Steps
If you would like to research more than, bank check out the References guide to acquire more virtually the detailed structure of NURBS curves and surfaces.
Source: https://developer.rhino3d.com/guides/general/essential-mathematics/parametric-curves-surfaces/
0 Response to "how to draw 3d curve in origin"
Post a Comment