All Projects → bfoz → geometry

bfoz / geometry

Licence: BSD-2-Clause license
Geometric primitives for Ruby

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to geometry

Cgal
The public CGAL repository, see the README below
Stars: ✭ 2,825 (+6041.3%)
Mutual labels:  geometry, geometry-processing
pyprt
Python bindings for the "Procedural Runtime" (PRT) of CityEngine by Esri.
Stars: ✭ 36 (-21.74%)
Mutual labels:  geometry, geometry-processing
BodyParts3D
Clone of the BodyParts3D/Anatomography 3D model files
Stars: ✭ 32 (-30.43%)
Mutual labels:  geometry, geometry-processing
Gogeom
This is a Geometrical library for Go Language. Which includes multiple Geometrical calculations like Circle, Lines etc in different forms
Stars: ✭ 47 (+2.17%)
Mutual labels:  geometry, geometry-processing
Directional
A library for Directional Field Synthesis, Design, and Processing.
Stars: ✭ 73 (+58.7%)
Mutual labels:  geometry, geometry-processing
Pymesh
Geometry Processing Library for Python
Stars: ✭ 1,135 (+2367.39%)
Mutual labels:  geometry, geometry-processing
PGS
Processing Geometry Suite
Stars: ✭ 39 (-15.22%)
Mutual labels:  geometry, geometry-processing
Matgeom
Matlab geometry toolbox for 2D/3D geometric computing
Stars: ✭ 168 (+265.22%)
Mutual labels:  geometry, geometry-processing
geometer
A geometry library written in Python
Stars: ✭ 89 (+93.48%)
Mutual labels:  geometry, geometry-library
batyr
Microservice for on-demand synchronization of geographical vector datasources to a PostgreSQL/PostGIS database. The service provides an HTTP API for easy integration into other applications.
Stars: ✭ 25 (-45.65%)
Mutual labels:  geometry
geofeatures2
A lightweight, high performance geometry library in Swift.
Stars: ✭ 18 (-60.87%)
Mutual labels:  geometry
Mathematics for Machine Learning
Learn mathematics behind machine learning and explore different mathematics in machine learning.
Stars: ✭ 28 (-39.13%)
Mutual labels:  geometry
EsriRESTScraper
A Python class that scrapes ESRI Rest Endpoints and exports data to a geodatabase
Stars: ✭ 43 (-6.52%)
Mutual labels:  geometry
ncdfgeom
NetCDF-CF Geometry and Timeseries Tools for R: https://code.usgs.gov/water/ncdfgeom
Stars: ✭ 13 (-71.74%)
Mutual labels:  geometry
classy blocks
Python classes for easier creation of OpenFOAM's blockMesh dictionaries.
Stars: ✭ 53 (+15.22%)
Mutual labels:  geometry
hydra-antlia
A collection of functions for Hydra
Stars: ✭ 45 (-2.17%)
Mutual labels:  geometry
vec
Vector graphics software to generate HPGL output to drive a plotter
Stars: ✭ 19 (-58.7%)
Mutual labels:  geometry
topo
A Geometry library for Elixir that calculates spatial relationships between two geometries
Stars: ✭ 125 (+171.74%)
Mutual labels:  geometry
tinymesh
TinyMesh is a light-weight mesh processing library in C/C++.
Stars: ✭ 64 (+39.13%)
Mutual labels:  geometry
SpatialSlur
Geometric data structures and algorithms for computational design tasks
Stars: ✭ 112 (+143.48%)
Mutual labels:  geometry-processing

Geometry for Ruby

Build Status Gem Version

Classes and methods for the handling of all of the basic geometry that you learned in high school (and then forgot).

The classes in this libary are based on the Vector class provided by the Ruby standard library. Geometric primitives are generally assumed to lie in 2D space, but aren't necessarily restricted to it. Please let me know if you find cases that don't work in higher dimensions and I'll do my best to fix them.

License

Copyright 2012-2016 Brandon Fosdick [email protected] and released under the BSD license.

Primitives

Examples

Point

point = Geometry::Point[3,4]    # 2D Point at coordinate 3, 4

# Copy constructors
point2 = Geometry::Point[point]
point2 = Geometry::Point[Vector[5,6]]

# Accessors
point.x
point.y
point[2]	# Same as point.z

# Zero
PointZero.new   # A Point full of zeros of unspecified length
Point.zero      # Another way to do the same thing
Point.zero(3)   # => Point[0,0,0]

Line

# Two-point constructors
line = Geometry::Line[[0,0], [10,10]]
line = Geometry::Line[Geometry::Point[0,0], Geometry::Point[10,10]]
line = Geometry::Line[Vector[0,0], Vector[10,10]]

# Slope-intercept constructors
Geometry::Line[Rational(3,4), 5]	# Slope = 3/4, Intercept = 5
Geometry::Line[0.75, 5]

# Point-slope constructors
Geometry::Line(Geometry::Point[0,0], 0.75)
Geometry::Line(Vector[0,0], Rational(3,4))

# Special constructors (2D only)
Geometry::Line.horizontal(y=0)
Geometry::Line.vertical(x=0)

Rectangle

# A Rectangle made from two corner points
Geometry::Rectangle.new [1,2], [2,3]
Geometry::Rectangle.new from:[1,2], to:[2,3]

Geometry::Rectangle.new center:[1,2], size:[1,1]	# Using a center point and a size
Geometry::Rectangle.new origin:[1,2], size:[1,1]	# Using an origin point and a size

# A Rectangle with its origin at [0, 0] and a size of [10, 20]
Geometry::Rectangle.new size: [10, 20]
Geometry::Rectangle.new size: Size[10, 20]
Geometry::Rectangle.new width: 10, height: 20

Circle

# A circle at Point[1,2] with a radius of 3
circle = Geometry::Circle.new center:[1,2], radius:3

Polygon

# A polygon that looks a lot like a square
polygon = Geometry::Polygon.new [0,0], [1,0], [1,1], [0,1]

Regular Polygon

# Everyone loves a good hexagon
hexagon = Geometry::RegularPolygon.new 6, :diameter => 3

Zeros and Ones

# For when you know you need a zero, but you don't know how big it should be
zero = Point.zero       # Returns a Point of indeterminate length that always compares equal to zero

# Oh, you wanted ones instead? No problem.
ones = Point.one        # => Point[1,1,1...1]

# Looking for something more exotic that a mere 1?
iso = Point.iso(5)      # => Point[5,5,5...5]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].