All Projects → ianmackenzie → elm-geometry-svg

ianmackenzie / elm-geometry-svg

Licence: MPL-2.0 license
Render 2D elm-geometry types as SVG

Programming Languages

elm
856 projects

Projects that are alternatives of or similar to elm-geometry-svg

polliwog
2D and 3D computational geometry library
Stars: ✭ 22 (-45%)
Mutual labels:  geometry, transformations
Elm Geometry
2D/3D geometry package for Elm
Stars: ✭ 162 (+305%)
Mutual labels:  geometry, transformations
Trimesh2
C++ library and set of utilities for input, output, and basic manipulation of 3D triangle meshes
Stars: ✭ 206 (+415%)
Mutual labels:  geometry, transformations
geometer
A geometry library written in Python
Stars: ✭ 89 (+122.5%)
Mutual labels:  geometry
humke-4d-geometry
A web-based 4D Geometry viewer
Stars: ✭ 51 (+27.5%)
Mutual labels:  geometry
wkb-parser
Well-known binary (WKB) Parser.
Stars: ✭ 69 (+72.5%)
Mutual labels:  geometry
pyspark-algorithms
PySpark Algorithms Book: https://www.amazon.com/dp/B07X4B2218/ref=sr_1_2
Stars: ✭ 72 (+80%)
Mutual labels:  transformations
paramak
Create parametric 3D fusion reactor CAD models
Stars: ✭ 36 (-10%)
Mutual labels:  geometry
envelope ex
Utilities for calculating and comparing envelopes from geometries
Stars: ✭ 15 (-62.5%)
Mutual labels:  geometry
Geometry-Solving
This is an open source project to share algorithms for solving the geometry games Pythagorea, Pythagorea 60, Euclidea 3 and Xsection
Stars: ✭ 17 (-57.5%)
Mutual labels:  geometry
paramak
Create parametric 3D fusion reactor CAD and neutronics models
Stars: ✭ 40 (+0%)
Mutual labels:  geometry
Shape-Your-Music
A web application for drawing music.
Stars: ✭ 106 (+165%)
Mutual labels:  geometry
osm-static-maps
Openstreetmap static maps is a nodejs lib, CLI and server open source inspired on google static map service
Stars: ✭ 130 (+225%)
Mutual labels:  geometry
three-csg-ts
CSG library for use with THREE.js
Stars: ✭ 312 (+680%)
Mutual labels:  geometry
geok
Kotlin geometry library
Stars: ✭ 29 (-27.5%)
Mutual labels:  geometry
SplashGeom
Open-source C++ library for geometry and linear algebra
Stars: ✭ 22 (-45%)
Mutual labels:  geometry
tyssue
An epithelium simulation library
Stars: ✭ 50 (+25%)
Mutual labels:  geometry
oriedita
Oriedita (fork of Orihime) is an origami crease pattern editor and folding simulator.
Stars: ✭ 28 (-30%)
Mutual labels:  geometry
xslweb
Web application framework for XSLT and XQuery developers
Stars: ✭ 39 (-2.5%)
Mutual labels:  transformations
source-engine-model-loader
Three.js loader for parsing Valve's Source Engine models
Stars: ✭ 54 (+35%)
Mutual labels:  geometry

elm-geometry-svg

This Elm package provides functions to create and manipulate SVG elements using the elm-geometry data types. You can:

  • Draw 2D elm-geometry objects as SVG
  • Apply elm-geometry-based 2D transformations to arbitrary SVG elements
  • Convert SVG between different coordinate systems

Drawing

The lineSegment2d, triangle2d, polyline2d, polygon2d, circle2d, ellipse2d, arc2d, ellipticalArc2d, quadraticSpline2d, cubicSpline2d, rectangle2d and boundingBox2d functions all produce standard Svg msg values that can be included in any SVG diagram:

lineSegment2d triangle2d polyline2d polygon2d circle2d

The appearance of the resulting elements can be customized by adding SVG attributes such as fill and stroke.

Transformation

The scaleAbout, rotateAround, translateBy and mirrorAcross functions behave just like their standard elm-geometry counterparts. You can use them to do things that would be difficult to do using just SVG, such as mirror a fragment of SVG across an arbitrary axis:

scaleAbout rotateAround translateBy mirrorAcross

Note that these functions will work on any Svg msg, value, not just ones that happen to have been produced with this package! So you can use them as a convenient way to transform SVG that you've produced in some other way.

Coordinate conversion

The relativeTo and placeIn functions allow you to take SVG defined in one coordinate system and convert it to another. For example, you can take SVG defined in a model coordinate system where (0,0) is the center and positive Y is up, and use relativeTo to convert it into SVG in window coordinates for display, where (0,0) is the top left corner and positive Y is down.

placeIn is useful for 'instancing' or 'stamping' a fragment of SVG in many different positions with different orientations:

placeIn

Installation

Assuming you have installed Elm and started a new project, you can install elm-geometry-svg by running

elm install ianmackenzie/elm-geometry-svg

in a command prompt inside your project directory.

Documentation

Full API documentation is available.

Climate action

I would like for the projects I work on to be as helpful as possible in addressing the climate crisis. If

  • you are working on a project that helps address the climate crisis (clean energy, public transit, reforestation, sustainable agriculture etc.) either as an individual, as part of an non-profit organization or even as part of a for-profit company, and
  • there is a new feature you would find helpful for that work (or a bug you need fixed) in any of my open-source projects, then

please open a new issue, describe briefly what you're working on and I will treat that issue as high priority.

Questions? Comments?

Please open a new issue if you run into a bug, if any documentation is missing/incorrect/confusing, or if there's a new feature that you would find useful (although note that this package is not meant to be general-purpose full-blown SVG package, more just a convenient way to render elm-geometry values). For general questions about using this package, try:

  • Joining the #geometry or #svg channels on the Elm Slack, or sending me (@ianmackenzie) a message - even if you don't have any particular questions right now, it would be great to know what you're hoping to do with the package!
  • Posting to the Elm Discourse forums

You can also find me on Twitter (@ianemackenzie), where I occasionally post elm-geometry-related stuff like demos or new releases. Have fun, and don't be afraid to ask for help!

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].