Basic Geometry Library

Basic Geometry Library

Introduction

Basic geometry Library is a library that aims to provide numerous geometric functions/formulas to do our job more easily. You can either get it here or see the source code here


How to start using it

You can do something like this

local geometry = require(game.Workspace:FindFirstChild("GeometryLibrary"))

Documentation

You may find the documentation here or you can read the following:

Triangle

geometry.triArea(base, height)
Returns the area of a triangle

geometry.triPerimeter(a, b, c)
Returns the perimeter of a triangle

geometry.rightTriPerimeter(height, base)
Returns the perimeter of a right triangle

geometry.right.TriHypo(a,b)
Returns the hyputenuse of a right triangle

Trigonometric functions

geometry.sec(theta)
Returns the secant of an angle θ

geometry.cot(theta)
Returns the cot of an angle θ

geometry.versin(theta)
Returns the versine of an angle θ

geometry.coversin(theta)
Returns the coversine of an angle θ

geometry.haversin(theta)
Returns the haversine of an angle θ

geometry.exsec(theta)
Returns the exsec of an angle θ
Example: Use it like the above
More trigonometric functions coming soon

Circle

geometry.circArea(r)
Returns the Area of a circle

geometry.circumference(r)
Returns the circumference of a circle

geometry.arcLength(radious,theta)
Returns the length of an arc

geometry.arcArea(radious,theta)
Returns the area of an arc

Rectangle

geometry.rectPerimeter(length,width)
Returns the perimeter of a rectangle
geometry.rectArea(length,width)
Returns the area of a rectangle
geometry.rectDiagonal(length,width)
Returns the diagonal of a rectangle

Parallelogram

geometry.paralPerimeter(a,b)
Returns the perimeter of a parallelogram
geometry.paralHeight(area,base)
Returns the height of a parallelogram
geometry.paralBase(area, height)
Returns the base of a parallelogram
geometry.paralArea(base,height)
Returns the area of a parallelogram

Trapezium

geometry.trapArea(a, b, h) where a, b are the parallel sides and h the distance between two parallel sides
Returns the trapezium Area
geometry.traHeight(area,a,b)
Returns the height of a trapezium
geometry.traBase(area,h,a)
Returns the base of a trapezium

Square

geometry.sqrPerimeter(a)
Returns the perimeter of a square
geometry.sqrArea(a)
Returns the square area
geometry.sqrDiagonal(a)
Returns the diagonal of a square
geometry.sqrSide(diagonal)
Returns the side of a square

Cube

geometry.cubeArea(a)
Returns the area of a cube
geometry.cubeVolume(a)
returns the Volume of a cube
geometry.cubeEdge(volume)
Returns the Edge of a cube
geometry.cubeDiagonal(a)
return the diagonal of a cube

Cylinder

geometry.cylTotalSurfaceArea(radious,height)
Returns the cylinder total surface area
geometry.cylCurvedSurfaceArea(radious,height)
Returns the cylinder curved surface area
geometry.cylVolume(radious,height)
Returns the volume of a cylinder
geometry.cylBaseArea
Returns the Base Area of a cylinder
geometry.cylRadious(volume,height)
Returns the radious of a cylinder

Cone

geometry.coneTotalSurfaceArea(radious, height)
Returns the total surface area of a cone
geometry.CurvedSurfaceArea(radious, I) (where I is slant height)
Returns the curved surface area of a cone
geometry.coneVolume(radious,height)
Returns the Volume of a cone
geometry.coneSlantHeight(height,radious)
Returns the slant height of a cone
geometry.coneBaseArea(radious)
Returns the base area of a cone

Sphere

geometry.sphereSurfaceArea(radious)
Returns the surface area of a sphere
geometry.sphereVolume(radious)
Returns the volume of a sphere
geometry.Diameter(radious)
Returns the diameter of a circle


Additional

I am planning to add more trigonometric functions and some other things soon.

The End

Note: Feel free to ask me anything, or suggest me anything. Constructive feedback is welcome!
17 Likes

I’m not exactly sure where this would be useful, but it’s still a quality contribution. Nice work.

2 Likes

Well, I do not think that it has a specific usefulness, but it was fun to make. Glad you like it!

Update [0.02] :

+ Added a github repository
+ Fixed some mistakes
+ Moved the documentation to github

Pending :

  • Add some more trigonometric functions

Easy geometry math operation comes pretty handy in making cool abilities vfx.

2 Likes