Skip to Main Content Skip to Search
Product Documentation

plot::Parallelogram2d2D parallelograms

plot::Parallelogram3d3D parallelograms

plot::Parallelogram2d(c, u, v) and plot::Parallelogram3d(c, u, v) defines a 2D, respectively 3D, parallelogram ImageSet(`c→` + Symbol::lambda*`u→` + Symbol::mu*`v→`, Symbol::lambda in [-1, 1], Symbol::mu in [-1, 1]) with center `c→` and vectors `u→`, `v→` spanning the plane of the parallelogram. This is a rectangle with sides of length 2*abs(`u→`), 2*abs(`v→`) if the vectors `u→` and `v→` are orthogonal.

→ Examples

Calls:

plot::Parallelogram2d([cx, cy], [ux, uy], [vx, vy], <a = amin .. amax>, Options)

plot::Parallelogram3d([cx, cy, cz], [ux, uy, uz], [vx, vy, vz], <a = amin .. amax>, Options)

Parameters:

cx, cy, cz

coordinates of the center: real numerical values or expressions of the animation parameter a
cx, cy, cz are equivalent to the attributes CenterX, CenterY, CenterZ.

ux, uy, uz

components of the first vector spanning the parallelogram: real numerical values or expressions of the animation parameter a
ux, uy, uz are equivalent to the attributes Tangent1X, Tangent1Y, Tangent1Z.

vx, vy, vz

components of the second vector spanning the parallelogram: real numerical values or expressions of the animation parameter a
vx, vy, vz are equivalent to the attributes Tangent2X, Tangent2Y, Tangent2Z.

See Also:

plot, plot::Box, plot::copy, plot::Line3d, plot::Polygon3d, plot::Rectangle

Details:

Example 1

We plot several rectangles and parallelograms using different presentation styles:

plot(plot::Parallelogram3d([1, 1, 1], [0, 0, 2], [0, 3, 0]),
     plot::Parallelogram3d([2, 2, 2], [0, 1, 4], [0, 2, 0],
                           FillColor = RGB::Red.[0.5]),
     plot::Parallelogram3d([3, 3, 3], [0, 1, 1], [0, 1, -1],
                           Filled = FALSE, LineStyle = Dashed,
                           LineColor = RGB::Black),
     plot::Parallelogram3d([4, 4, 4], [0, 1, 2], [0, 2, -2],
                           Filled = FALSE, LineColor = RGB::Green)
):

MuPAD graphics

Example 2

We use plot::Parallelogram3d to visualize tangent planes of a surface. The first surface is the graph of the function f(x, y) = x^2 + y^2. At a point (x, y, f(x, y)) on the graph, the tangent vectors in the x and y direction are given by (1, 0, 2*x) and (0, 1, 2*y), respectively. After normalization to the length 0.4, they yield the tangent vectors u, v used in the construction of the tangent planes:

f := (x, y) -> x^2 + y^2:
c:= (x, y) -> [x, y, f(x, y)]:
u := (x, y) -> [0.4/sqrt(1+4*x^2), 0, 0.8*x/sqrt(1+4*x^2)]:
v := (x, y) -> [0, 0.4/sqrt(1+4*y^2), 0.8*y/sqrt(1+4*y^2)]:
plot(plot::Function3d(f(x, y), x = -1..1, y = -1..1),
     plot::Parallelogram3d(c(0, 0), u(0, 0), v(0, 0),
                           Color = RGB::Grey.[0.5]),
     plot::Parallelogram3d(c(0, -1), u(0, -1), v(0, -1),
                           Color = RGB::Grey.[0.5]),
     plot::Parallelogram3d(c(-1, 0), u(-1, 0), v(-1, 0),
                           Color = RGB::Grey.[0.5]),
     plot::Parallelogram3d(c(-1/2, -1/2), u(-1/2, -1/2),
                           v(-1/2, -1/2),
                           Color = RGB::Grey.[0.5])):

MuPAD graphics

The second surface is a sphere, parametrized by spherical coordinates p and t (polar and azimuth angle). At a point (x(p, t), y(p, t), z(p, t)) on the sphere, the tangent vectors in the p and t direction are given by differention of x, y, z w.r.t. p and t, respectively. After normalization to the length 0.5, they yield the tangent vectors u, v used in the construction of the tangent planes:

x := (p, t) -> cos(p)*sin(t):
y := (p, t) -> sin(p)*sin(t):
z := (p, t) -> cos(t):
c := (p, t) -> [x(p, t), y(p, t), z(p, t)]:
u := (p, t) -> [-0.5*sin(p), 0.5*cos(p), 0]:
v := (p, t) -> [0.5*cos(p)*cos(t), 0.5*sin(p)*cos(t),
                -0.5*sin(t)]:
plot(plot::Surface(c(p, t), p = 0..2*PI, t = 0..PI),
     plot::Point3d(c(0, 0), Color = RGB::Black),
     plot::Parallelogram3d(c(0, 0), u(0, 0), v(0, 0),
                           Color = RGB::Grey.[0.5]),
     plot::Point3d(c(-3*PI/4, PI/4), Color = RGB::Black),
     plot::Parallelogram3d(c(-3*PI/4, PI/4),
                           u(-3*PI/4, PI/4),
                           v(-3*PI/4, PI/4),
                           Color = RGB::Grey.[0.5]),
     plot::Point3d(c(-PI/2, PI/3), Color = RGB::Black),
     plot::Parallelogram3d(c(-PI/2, PI/3),
                           u(-PI/2, PI/3),
                           v(-PI/2, PI/3),
                           Color = RGB::Grey.[0.5]),
     plot::Point3d(c(PI, PI/2), Color = RGB::Black),
     plot::Parallelogram3d(c(PI, PI/2),
                           u(PI, PI/2),
                           v(PI, PI/2),
                           Color = RGB::Grey.[0.5]),
     Scaling = Constrained):

MuPAD graphics

delete f, c, u, v, x, y, z:

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS