|
2 | 2 | [](https://travis-ci.com/JuliaGeometry/GeometryBasics.jl) |
3 | 3 | [](https://codecov.io/gh/JuliaGeometry/GeometryBasics.jl) |
4 | 4 |
|
5 | | -**Documentation**: |
6 | 5 | [](http://juliageometry.github.io/GeometryBasics.jl/stable/) |
7 | | -[](http://juliageometry.github.io/GeometryBasics.jl/dev) |
| 6 | +[](http://juliageometry.github.io/GeometryBasics.jl/dev/) |
8 | 7 |
|
9 | 8 | # GeometryBasics.jl |
10 | 9 |
|
11 | | -Basic Geometry Types. |
12 | | -This package aims to offer a standard set of Geometry types, which easily work with metadata, query frameworks on geometries and different memory layouts. |
13 | | -The aim is to create a solid basis for Graphics/Plotting, finite elements analysis, Geo applications, and general geometry manipulations - while offering a julian API, that still allows performant C-interop. |
| 10 | +Basic geometry types. |
14 | 11 |
|
15 | | -This package is a replacement for the discontinued [GeometryTypes](https://github.com/JuliaGeometry/GeometryTypes.jl/). |
16 | | - |
17 | | -## Quick start |
18 | | - |
19 | | -```julia |
20 | | -using GeometryBasics |
21 | | - |
22 | | -# create some points |
23 | | -julia> p1 = Point(3, 1) |
24 | | -2-element Point{2,Int64} with indices SOneTo(2): |
25 | | - 3 |
26 | | - 1 |
27 | | - |
28 | | -julia> p2 = Point(1, 3); |
29 | | - |
30 | | -julia> p3 = Point(4, 4); |
31 | | - |
32 | | -# geometries can carry metadata |
33 | | -julia> poi = meta(p1, city="Abuja", rainfall=1221.2) |
34 | | -2-element PointMeta{2,Int64,Point{2,Int64},(:city, :rainfall),Tuple{String,Float64}} with indices SOneTo(2): |
35 | | - 3 |
36 | | - 1 |
37 | | - |
38 | | -# metadata is stored in a NamedTuple and can be retrieved as such |
39 | | -julia> meta(poi) |
40 | | -(city = "Abuja", rainfall = 1221.2) |
41 | | - |
42 | | -# specific metadata attributes can be directly retrieved |
43 | | -julia> poi.rainfall |
44 | | -1221.2 |
| 12 | +This package aims to offer a standard set of geometry types that easily work |
| 13 | +with metadata, query frameworks on geometries and different memory layouts. The |
| 14 | +aim is to create a solid basis for graphics/plotting, finite element analysis, |
| 15 | +geo applications, and general geometry manipulations - while offering a Julian |
| 16 | +API that still allows performant C-interop. |
45 | 17 |
|
46 | | -# to remove the metadata and keep only the geometry, use metafree |
47 | | -julia> metafree(poi) |
48 | | -2-element Point{2,Int64} with indices SOneTo(2): |
49 | | - 3 |
50 | | - 1 |
51 | | - |
52 | | -# for other geometries metatypes are predefined |
53 | | -julia> multipoi = MultiPointMeta([p1], city="Abuja", rainfall=1221.2) |
54 | | -1-element MultiPointMeta{Point{2,Int64},MultiPoint{2,Int64,Point{2,Int64},Array{Point{2,Int64},1}},(:city, :rainfall),Tuple{String,Float64}}: |
55 | | -[3, 1] |
56 | | - |
57 | | -# connect the points with lines |
58 | | -julia> l1 = Line(p1, p2) |
59 | | -Line([3, 1] => [1, 3]) |
60 | | - |
61 | | -julia> l2 = Line(p2, p3); |
62 | | - |
63 | | -# connect the lines in a linestring |
64 | | -julia> LineString([l1, l2]) |
65 | | -2-element LineString{2,Int64,Point{2,Int64},Array{GeometryBasics.Ngon{2,Int64,2,Point{2,Int64}},1}}: |
66 | | - Line([3, 1] => [1, 3]) |
67 | | - Line([1, 3] => [4, 4]) |
68 | | - |
69 | | -# linestrings can also be constructed directly from points |
70 | | -julia> LineString([p1, p2, p3]) |
71 | | -2-element LineString{2,Int64,Point{2,Int64},Base.ReinterpretArray{GeometryBasics.Ngon{2,Int64,2,Point{2,Int64}},1,Tuple{Point{2,Int64},Point{2,Int64}},TupleView{Tuple{Point{2,Int64},Point{2,Int64}}, 1}}}: |
72 | | - Line([3, 1] => [1, 3]) |
73 | | - Line([1, 3] => [4, 4]) |
| 18 | +This package is a replacement for the discontinued [GeometryTypes](https://github.com/JuliaGeometry/GeometryTypes.jl/). |
74 | 19 |
|
75 | | -# the same goes for polygons |
76 | | -julia> Polygon(Point{2, Int}[(3, 1), (4, 4), (2, 4), (1, 2), (3, 1)]) |
77 | | -Polygon{2,Int64,Point{2,Int64},LineString{2,Int64,Point{2,Int64},Base.ReinterpretArray{GeometryBasics.Ngon{2,Int64,2,Point{2,Int64}},1,Tuple{Point{2,Int64},Point{2,Int64}},TupleView{Tuple{Point{2,Int64},Point{2,Int64}}, 1}}},Array{LineString{2,Int64,Point{2,Int64},Base.ReinterpretArray{GeometryBasics.Ngon{2,Int64,2,Point{2,Int64}},1,Tuple{Point{2,Int64},Point{2,Int64}},TupleView{Tuple{Point{2,Int64},Point{2,Int64}}, 1}}},1}}(GeometryBasics.Ngon{2,Int64,2,Point{2,Int64}}[Line([3, 1] => [4, 4]), Line([4, 4] => [2, 4]), Line([2, 4] => [1, 2]), Line([1, 2] => [3, 1])], LineString{2,Int64,Point{2,Int64},Base.ReinterpretArray{GeometryBasics.Ngon{2,Int64,2,Point{2,Int64}},1,Tuple{Point{2,Int64},Point{2,Int64}},TupleView{Tuple{Point{2,Int64},Point{2,Int64}}, 1}}}[]) |
| 20 | +**Documentation:** http://juliageometry.github.io/GeometryBasics.jl/stable/ |
78 | 21 |
|
79 | | -# create a rectangle placed at the origin with unit widths |
80 | | -julia> rect = Rect(Vec(0.0, 0.0), Vec(1.0, 1.0)) |
81 | | -GeometryBasics.HyperRectangle{2,Float64}([0.0, 0.0], [1.0, 1.0]) |
| 22 | +## Contributing |
82 | 23 |
|
83 | | -# decompose the rectangle into two triangular faces |
84 | | -julia> rect_faces = decompose(TriangleFace{Int}, rect) |
85 | | -2-element Array{NgonFace{3,Int64},1}: |
86 | | - TriangleFace(1, 2, 4) |
87 | | - TriangleFace(1, 4, 3) |
| 24 | +Make sure your changes don't break the documentation. |
88 | 25 |
|
89 | | -# decompose the rectangle into four vertices |
90 | | -julia> rect_vertices = decompose(Point{2, Float64}, rect) |
91 | | -4-element Array{Point{2,Float64},1}: |
92 | | - [0.0, 0.0] |
93 | | - [1.0, 0.0] |
94 | | - [0.0, 1.0] |
95 | | - [1.0, 1.0] |
| 26 | +To build the documentation locally, you first need to instantiate the `docs/` project: |
96 | 27 |
|
97 | | -# combine the vertices and faces into a triangle mesh |
98 | | -julia> mesh = Mesh(rect_vertices, rect_faces) |
99 | | -Mesh{2, Float64, Triangle}: |
100 | | - Triangle([0.0, 0.0], [1.0, 0.0], [1.0, 1.0]) |
101 | | - Triangle([0.0, 0.0], [1.0, 1.0], [0.0, 1.0]) |
102 | 28 | ``` |
| 29 | +julia --project=docs/ |
| 30 | +pkg> instantiate |
| 31 | +pkg> dev . |
| 32 | +``` |
| 33 | + |
| 34 | +Then use `julia --project=docs/ docs/make.jl` to build the documentation. This |
| 35 | +will also run the doctests defined in Markdown files. The doctests should be |
| 36 | +written for the Julia version configured in [ci.yml](.github/workflows/ci.yml) |
| 37 | +(`:docs` section). |
0 commit comments