Drawing a Convex Hull in Maple

In summary, to draw a convex hull in Maple, you can use the "convexhull" command in the "geometry" package and to label the vertices, you can use the "textplot" command.
  • #1
Mathman23
254
0
Urgent Question: Drawing a Convex Hull in Maple

Homework Statement



Drawing a Convex Hull of 5 2D Points...

Homework Equations



None

The Attempt at a Solution



Hi there,

I am trying draw the convex hull of the 5 points x1,x2,x3,x4,x5 below.

Is this the correct way of doing this??

The points are presented in the nation [tex]x_i = (a,b)^t[/tex].

What eactly does this mean?

I know that [tex]A^t[/tex] means a transposed matrix.

Does [tex]x_i = (a,b)^t[/tex] simply mean [tex]x_i = \left[\begin{array}{c} a \\ b \end{array}\right][/tex] ??
Do I need to make the maple sheet below not draw the complete complex hull?


Code:
with(geometry);
  [Apollonius, AreCollinear, AreConcurrent, AreConcyclic,

        AreConjugate, AreHarmonic, AreOrthogonal, AreParallel,

        ArePerpendicular, AreSimilar, AreTangent, CircleOfSimilitude,

        CrossProduct, CrossRatio, DefinedAs, Equation, EulerCircle,

        EulerLine, ExteriorAngle, ExternalBisector, FindAngle,

        GergonnePoint, GlideReflection, HorizontalCoord,

        HorizontalName, InteriorAngle, IsEquilateral, IsOnCircle,

        IsOnLine, IsRightTriangle, MajorAxis, MakeSquare, MinorAxis,

        NagelPoint, OnSegment, ParallelLine, PedalTriangle,

        PerpenBisector, PerpendicularLine, Polar, Pole, RadicalAxis,

        RadicalCenter, RegularPolygon, RegularStarPolygon,

        SensedMagnitude, SimsonLine, SpiralRotation,

        StretchReflection, StretchRotation, TangentLine,

        VerticalCoord, VerticalName, altitude, apothem, area,

        asymptotes, bisector, center, centroid, circle, circumcircle,

        conic, convexhull, coordinates, detail, diagonal, diameter,

        dilatation, directrix, distance, draw, dsegment, ellipse,

        excircle, expansion, foci, focus, form, homology, homothety,

        hyperbola, incircle, inradius, intersection, inversion, line,

        medial, median, method, midpoint, orthocenter, parabola,

        perimeter, point, powerpc, projection, radius, randpoint,

        reciprocation, reflection, rotation, segment, sides,

        similitude, slope, square, stretch, tangentpc, translation,

        triangle, vertex, vertices]

> point(x1,[-1,-1]),point(x2,[-1,1]),point(x3,[0,-1]),point(x4,[2,0]),point(x5,[1,1]): hullname:=convexhull({ x1, x2, x3, x4, x5});

> Polygen(hullname): draw({x1,x2,x3,x4,x5},printtext=true,axes=NONE);

Here is a printout of the Convex Hull:

http://img114.imageshack.us/img114/6499/convexpl6.jpg [Broken]

Do this look okay??

Secondly I have tried to draw the polygon in maple, but I am unable to complete the convex hull, and label the vertices.

http://img529.imageshack.us/img529/936/convex2la4.jpg [Broken]

Here is the code that I used, maybe there is somebody who can gave me a hint on howto label the vertices, and to plot the convex hull ?

Code:
with(plottools):
> l := polygon([[-1,-1], [-1,1], [0,-1],[2,0],[1,1]], color=black, linestyle=3, thickness=2);
> plots[display](l);

Best Regards
Fred
 
Last edited by a moderator:
Physics news on Phys.org
  • #2


Hello Fred,

To draw a convex hull in Maple, you can use the "convexhull" command in the "geometry" package. This command takes a set of points as input and returns a polygon representing the convex hull of those points. In your case, you can use the following code:

with(geometry):
x1 := point([-1,-1]);
x2 := point([-1,1]);
x3 := point([0,-1]);
x4 := point([2,0]);
x5 := point([1,1]);
hull := convexhull({x1,x2,x3,x4,x5});
Polygen(hull);

This will draw the convex hull of your 5 points. To label the vertices, you can use the "textplot" command. For example:

textplot([-1,-1], "x1", align={above,right});
textplot([-1,1], "x2", align={below,right});
textplot([0,-1], "x3", align={above,left});
textplot([2,0], "x4", align={below,left});
textplot([1,1], "x5", align={above,right});

This will label each vertex with its corresponding point label. You can also change the alignment and font size of the labels as desired. Hope this helps!
 
  • #3


Hi Fred,

Thank you for your question. Yes, it looks like you have correctly drawn the convex hull of the 5 given points. The notation x_i = (a,b)^t means that x_i is a vector with components a and b, and the superscript t denotes the transpose of the vector. So, your interpretation of x_i = \left[\begin{array}{c} a \\ b \end{array}\right] is correct.

To label the vertices, you can use the pointlabel option in the polygon command. For example, you can label the first vertex as "x1" by changing the first element in the polygon command to [-1,-1], pointlabel=["x1"], and following the same format for the remaining vertices. To plot the convex hull, you can use the convexhull command and then plot the resulting polygon. Here is an example:

with(plottools):
> l := polygon([[-1,-1], [-1,1], [0,-1],[2,0],[1,1]], color=black, linestyle=3, thickness=2, pointlabel=["x1","x2","x3","x4","x5"]);
> h := convexhull({ x1, x2, x3, x4, x5});
> l, polygon(h, color=red, linestyle=1, thickness=2);

I hope this helps. If you have any further questions, please let us know. Good luck with your Maple project!
 

1. What is a Convex Hull and why is it important in Maple?

A Convex Hull is a geometric shape that contains all the given points within its boundary in the most compact way possible. In Maple, it is important because it is an essential tool for visualizing and analyzing data, especially in scientific and engineering fields.

2. How do I draw a Convex Hull in Maple?

To draw a Convex Hull in Maple, you can use the command "ConvexHull(points)" where "points" is a list of coordinates or data points. This command will return the Convex Hull as a closed polygon or a set of lines depending on the data points.

3. Can I customize the appearance of the Convex Hull in Maple?

Yes, you can customize the appearance of the Convex Hull in Maple by using different options in the "ConvexHull" command. For example, you can change the color, thickness, and style of the lines or fill the polygon with a specific color.

4. Is it possible to draw a Convex Hull for 3D data in Maple?

Yes, it is possible to draw a Convex Hull for 3D data in Maple. You can use the command "ConvexHull(points, options)" where "points" is a list of 3D coordinates and "options" can include parameters for 3D visualization, such as perspective and lighting.

5. Can I export the Convex Hull drawn in Maple to other software or file formats?

Yes, you can export the Convex Hull drawn in Maple to other software or file formats. You can use the "Export" command and select the desired file format, such as JPEG or PDF, to save the Convex Hull for use in other programs or for printing.

Back
Top