RandomPolygon
gives a pseudorandom simple polygon with n vertex points.
RandomPolygon[spec]
gives a pseudorandom polygon with the specified specification spec.
RandomPolygon[spec,k]
gives a list of k pseudorandom polygons.
RandomPolygon[dspec,…]
gives a pseudorandom polygon in dimension d.
Details and Options
- RandomPolygon gives a Polygon drawn from a specific distribution.
- RandomPolygon is typically used in testing and verification of time complexity for algorithms.
- Possible specifications spec include:
-
{"Convex",n} convex polygons with n vertex points {"Simple",n} simple polygons with n vertex points {"StarShaped",n} star‐shaped polygons with n vertex points {"ConvexHull",dist,n} convex hull of n random points from the distribution dist - RandomPolygon[] gives a pseudorandom simple polygon with the number of vertex points chosen in the range {3,15} with equal probability.
- RandomPolygon[n] is equivalent to RandomPolygon[{"Simple",n}].
- RandomPolygon[{"ConvexHull",n}] gives the convex hull of n random points from the uniform distribution UniformDistribution[2] over the unit square.
- RandomPolygon[spec,{k1,k2,…}] gives a k1×k2×… array of pseudorandom polygons.
- RandomPolygon gives a different sequence of pseudorandom polygons whenever you run the Wolfram Language. By using SeedRandom, you can get a repeatable sequence.
- RandomPolygon has the same options as Polygon with the following additions: [List of all options]
-
DataRange Automatic the range of vertex points to generate WorkingPrecision MachinePrecision precision of vertex points - With the default setting DataRangeAutomatic, coordinates are chosen in the range 0 to 1.
-
DataRange Automatic the range of vertex points to generate VertexColors Automatic vertex colors to be interpolated VertexNormals Automatic effective vertex normals for shading VertexTextureCoordinates None coordinates for textures WorkingPrecision MachinePrecision precision of vertex points
List of all options
Examples
open allclose allBasic Examples (3)
Scope (15)
Options (8)
DataRange (1)
DataRange allows you to specify the range of vertex points to generate:
WorkingPrecision (1)
VertexColors (2)
VertexNormals (1)
VertexTextureCoordinates (3)
Texture mapping with 2D random polygons:
Repeat a texture by using non-unified texture coordinate values:
Texture mapping is preceded by VertexColors:
Applications (5)
Basic Uses (2)
Geometry Probability (2)
Properties & Relations (5)
Use SeedRandom to get repeatable random polygons:
Use BlockRandom to block one use of RandomPolygon from affecting others:
Use ConvexPolygonQ to check the property of a random polygon:
The OuterPolygon of a random polygon is simple:
Random polygons do not have holes:
Using PolygonDecomposition to decompose a polygon into convex polygons:
Text
Wolfram Research (2019), RandomPolygon, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomPolygon.html.
CMS
Wolfram Language. 2019. "RandomPolygon." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RandomPolygon.html.
APA
Wolfram Language. (2019). RandomPolygon. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomPolygon.html