intersectplot - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Graphics : 3-D : intersectplot

plots

  

intersectplot

  

plot intersection of 2 surfaces in 3-D

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

intersectplot(surface1, surface2, options)

intersectplot(expr1, expr2, x=a..b, y=c..d, options)

intersectplot(proc1, proc2, a..b, c..d, options)

intersectplot(expr1, expr2, x=a..b, y=c..d, z=e..f, options)

intersectplot(proc1, proc2, a..b, c..d, e..f, options)

Parameters

surface1,surface2

-

surface specifications

expr1,expr2

-

expressions representing implicit surfaces

proc1,proc2

-

procedures representing implicit surfaces

x,y,z

-

plotting variables (axes)

a,b,c,d,e,f

-

real values for ranges

options

-

sequence of options to apply to plot

Description

• 

The intersectplot command plots the intersections in three-dimensional space between a pair of two-dimensional surfaces. The command is quite flexible, as the surfaces can be specified as functions of x,y, as parametric surfaces, or as implicit surfaces, in any combination.

• 

Valid surface specifications include the following:

– 

surface(f(x,y), x=a..b, y=c..d), where f(x,y) is an expression depending only on x,y, and a,b,c,d are real constants. This represents the surface z=f(x,y) for plotting coordinates (x,y,z).

– 

surface([x(s,t),y(s,t),z(s,t)],s=a..b,t=c..d), where x(s,t),y(s,t),z(s,t) are expressions depending only on s,t, and a,b,c,d are real constants. This represents a parametric surface where the three coordinates are expressed in terms of the parameters s and t. A vector or Vector may be used in place of the list.

– 

surface(F(x,y,z)=G(x,y,z),x=a..b,y=c..d,z=e..f), where F(x,y,z) and G(x,y,z) are expressions depending only on x,y,z and a,b,c,d,e,f are real constants. This represents a surface given implicitly by the equation F(x,y,z)=G(x,y,z). The equation F(x,y,z) = 0 may be replaced by the expression F(x,y,z).

• 

In addition, each of these surface specifications can be replaced by a procedure form, where the expressions are replaced by procedures, and the provided ranges are unnamed: surface(f,a..b,c..d) surface([x,y,z],a..b,c..d) surface(F=G,a..b,c..d,e..f) or surface(F,a..b,c..d,e..f)

• 

If both surfaces are parametric or of the form z=f(x,y) then a short form can be used where the functions can be specified only once, and the variable or parameter ranges follow. This corresponds to the 2nd and 3rd calling sequences above.

• 

Similarly, if both surfaces are implicit, then the expressions or equations can be specified, followed by the three ranges. This corresponds to the 4th and 5th calling sequences above.

• 

If one surface is parametric and the other is implicit, -infinity..infinity may be used in the ranges for the implicit surface. Otherwise all ranges must be positive and nonempty, with finite constant bounds.

• 

The available options depend upon the combination of the surfaces being sent to intersectplot, and are itemized here for each combination.

• 

Note that in terms of relative efficiency, the mixed plotter is the most efficient, so if the curve intersection to plot can be cast in that framework, it will provide the most detailed plot in the smallest time. Conversely the plotter for two parametric surfaces is the most expensive, hence the reason for the smallest default values for the settings.

Two implicit surfaces

• 

If both surfaces are implicit, then intersectplot divides the three dimensional region into rectangular cells at the initial resolution, then computes the values of the two implicit functions at all corners of the cells.

  

Each cell is divided into 4 tetrahedra, and any of the tetrahedra where both of the implicit surfaces intersect are stored for further processing.

  

The algorithm then iterates a number of times, splitting each stored tetrahedra into 4 tetrahedra, retaining only those that both surfaces intersect. This continues for either three passes or until the total number of tetrahedra exceeds 50000.

  

Finally, the intersections are interpolated by a line segment inside each tetrahedra, which produces the final plot.

• 

The available options are:

• 

grid - positive integer, or list of 3 positive integers (default 10). This specifies the number of cells to divide the three dimensional region into along each dimension. Specification of 100, for example, would require 100x100x100 or one million cells, so best to be a bit conservative, and use maxlev below to increase refinement.

• 

maxlev - nonnegative integer (default 3). This specifies the number of subdivision iterations to perform on the tetrahedra from the initial grid. Note that each subdivision is equivalent to a doubling of the number of cells initially used, so by default, the output detail level is equivalent to a 2^3*10=80 cubed grid. Setting maxlev to 4 would give a 2^4*10=160 cubed grid.

• 

maxtet - positive integer (default 50000). This specifies a bound on the number of tetrahedra to halt the subdivision process. This does not actually bound the number of tetrahedra that are examined for line segments. For example, if we have 49999 tetrahedra, and another subdivision iteration is performed, we may end up with as many as 4*49999=199996 tetrahedra, and as many line segments.

One parametric/explicit surface and one implicit/explicit surface

• 

If one surface is either parametric or explicit while the other is either implicit or explicit, then one surface is treated as parametric, and the other is treated as implicit.

  

The intersection is computed as the zeros of the implicit function with the independent variables replaced by the parametric surface description. i.e. The intersection of F(x,y,z)=0 and [X(s,t),Y(s,t),Z(s,t)] is computed as the zeros of G(s,t)=F(X(s,t),Y(s,t),Z(s,t)) varying s and t.

  

The values of G(s,t) are computed on a rectangular mesh in s and t, each rectangle is divided into two triangles, and and triangles containing G(s,t)=0 are retained for further computation.

  

The retained triangles are then iteratively subdivided. At each step, a single triangle is divided into 4 triangles.

  

Finally, for each triangle containing a zero of G(s,t), a line segment is computed and placed in the output plot.

• 

The available options are:

• 

grid - positive integer, or list of 2 positive integers (default 25). This specifies the number of rectangles to divide the two dimensional parametric region into along each dimension. Specification of 100, for example, would require 100x100 or 10000 cells.

• 

maxlev - nonnegative integer (default 5). This specifies the number of subdivision iterations to perform on the triangles from the initial grid. Note that each subdivision is equivalent to a doubling of the number of cells initially used, so by default, the output detail level is equivalent to a 2^5*25=800 squared grid. Setting maxlev to 4 would give a 2^4*25=400 squared grid.

• 

maxtri - positive integer (default 50000). This specifies a bound on the number of triangles to halt the subdivision process. This does not actually bound the number of triangles that are examined for line segments. For example, if we have 49999 triangles, and another subdivision iteration is performed, we may end up with as many as 4*49999=199996 triangles, and as many line segments.

Two parametric surfaces

• 

If both surfaces are parametric, then surfaceplot proceeds by forming the triangles describing each surface independently (2-d process), placing them into a 3-d array of bins that cover the 3-d area spanned by the surface intersection area.

  

Any bins that contain triangles from both surfaces are marked for further examination.

  

Each triangle in the marked bins is then subdivided into a specified number of subtriangles along each dimension, and these triangles are placed into a second set of finer bins.

  

Finally, for any of the finer bins that are common to both surfaces, the triangles from both surfaces are examined to detect intersections (line segments).

• 

The available options are:

• 

grid1 - positive integer, or list of 2 positive integers (default 10). This specifies the number of rectangles to divide the two dimensional parametric region into along each dimension for the first parametric surface. Specification of 20, for example, would require 20x20 or 400 cells.

• 

grid2 - positive integer, or list of 2 positive integers (default 10). This is identical to grid1, except this applies to the second surface.

• 

bins - positive integer (default 10). This specifies the number of bins to use, along each dimension when placing the triangles to assess whether they need further examination. Note that choosing too small a bit size will cause too many triangles to be included in each bin, while choosing too large a bin size will require significant memory be used for the bin array, and may require that too many bins require further examination. The optimal value is a balance to keep both the number of bins, and the number of triangles in each bin as small as possible.

• 

subdivisions - nonnegative integer (default 5). This specifies the number of divisions to perform on the triangles for any that are in bins common to both curves. So specification of 5 will cause five additional values to be added along each axis, and as a result will break down each triangle into $(5+1)^2=36$ triangles. This allows for a refinement of the final plot. Note that the number of finer bins used in the second stage of the algorithm is given by bins*(subdivisions+1). At the default setting, the number of finer bins used is $10(5+1)=60$ along each axis.

Examples

withplots,intersectplot:

Two implicit surfaces

Pintersectplotx2+y2+z2=1,x2y2=zz1,x=1..1,y=1..1,z=1..1,axes=box,thickness=2,orientation=70,40:

P

Plotting along with the sphere

plotsdisplayP,plottoolssphere0,0,0,1

Same surface intersections using the parametric form for the sphere

intersectplotsurfacesinscost,sinssint,coss,s=0..π,t=0..2π,surfacex2y2=zz1,x=1..1,y=1..1,z=1..1,axes=box,thickness=2,orientation=70,40

Same surface intersections with both parametric

intersectplotsurfacesinscost,sinssint,coss,s=0..π,t=0..2π,surfacesinhv2,coshvcosu2,coshvsinu+12,u=0..2π,v=3..3,axes=box,thickness=2,orientation=70,40

A difficult example, as the surfaces are nearly tangent along a curve.  These are the commands to create the plot from the Plotting Guide.

P1intersectplotsurfacecosu+v,sinuv,cosu+cosv,u=0..2π,v=0..2π,surfacesinscost,sinssint,coss,s=0..π,t=π..π,orientation=145,90:

P1

P2plot3dcosu+v,sinuv,cosu+cosv,u=0..2π,v=0..2π:

P3plottoolssphere0,0,0,1,color=blue:

plotsdisplayP1,P2,P3,orientation=50,90,scaling=constrained

See Also

plot

plots