Geometry

Constants

Types

Polymath.Geometry.PointType
Point(x, y)
Point(x, y, z)

Structure containing 2D or 3D coordinates.

Examples

julia> p1 = Point(1, 2, 3)
Point(1, 2, 3)

julia> p2 = Point(4, 5)
Point(4, 5, nothing)
source

Functions

Polymath.Geometry.area_ellipseFunction
area_ellipse(major_semiaxis, minor_semiaxis)

Calculate area of an ellipse given the major and minor semiaxes.

Example

julia> area_ellipse(50.575, 50.419)
8010.875677067962
source
Polymath.Geometry.area_trapezoidFunction
area_trapezoid(base_length, top_length, height)

Calculate area of a trapezoid given the base length, top length, and height.

Example

julia> area_trapezoid(30.5, 10.5, 20.75)
425.375
source
Polymath.Geometry.area_triangleFunction
area_triangle(base_length, height)

Calculate area of a triangle given the base length and height.

Example

julia> area_triangle(42.5, 32.50)
690.625
source
Polymath.Geometry.edgesFunction
edges(faces, vertices)

Calculate edges of a convex polyhedron given the faces and vertices.

Example

julia> edges(6, 8)
12
source
Polymath.Geometry.facesFunction
faces(edges, vertices)

Calculate faces of convex polyhedron given the edges and vertices.

Example

julia> faces(12, 8)
6
source
Polymath.Geometry.verticesFunction
vertices(edges, faces)

Calculate vertices of a convex polyhedron given the edges and faces.

Example

julia> vertices(12, 6)
8
source
Polymath.Geometry.has_euler_characteristicFunction
has_euler_characteristic(edges, faces, vertices)

Determine whether or not a polyhedron has the Euler characteristic given the edges, faces, and vertices.

Examples

julia> has_euler_characteristic(6, 4, 4) # tetrahedron
true

julia> has_euler_characteristic(12, 7, 6) # tetrahemihexahedron
false
source
Polymath.Geometry.pytheoremFunction
pytheorem(leg_a, leg_b)

Calculate (using the Pythagorean theorem) area of the square formed along the hypotenuse of a right triangle given the length of the legs.

Examples

julia> pytheorem(3, 7)
58

julia> hypotenuse_length(3, 7) ^ 2
58
source
Polymath.Geometry.hypotenuse_lengthFunction
hypotenuse_length(leg_a, leg_b)

Calculate length of a hypotenuse given the length of the legs. The hypotenuse is the longest side of a right triangle and is opposite of the 90° angle.

Examples

julia> hypotenuse_length(4, 7)
8.06225774829855

julia> sqrt(pytheorem(4, 7))
8.06225774829855
source
Polymath.Geometry.leg_lengthFunction
leg_length(leg, hypotenuse)

Calculate length of a missing right triangle leg given the lengths of an existing leg and the hypotenuse.

Example

julia> leg_length(4, 8.0623)
7.000048663402277
source
Polymath.Geometry.distance_2dFunction
distance_2d(x1, y1, x2, y2)
distance_2d(p1, p2)

Calculate distance between a pair of 2D points given the coordinates.

Examples

julia> distance_2d(25, 42, 35, 80)
39.293765408777

julia> p1 = Point(25, 42)
Point(25, 42, nothing)

julia> p2 = Point(35, 80)
Point(35, 80, nothing)

julia> distance_2d(p1, p2)
39.293765408777
source
Polymath.Geometry.distance_3dFunction
distance_3d(x1, y1, z1, x2, y2, z2)
distance_3d(p1, p2)

Calculate distance between a pair of 3D points given the coordinates.

Examples

julia> distance_3d(14, 8, 5, 17, 38, 23)
35.11409973215888

julia> p1 = Point(14, 8, 5)
Point(14, 8, 5)

julia> p2 = Point(17, 38, 23)
Point(17, 38, 23)

julia> distance_3d(p1, p2)
35.11409973215888
source