This repository has been archived by the owner on Oct 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Tessellation tools: clusters Fixes #257 added cluster lattice modified latticebasis to use matrix to represent basis vectors instead of SVector{SVector}}. Simpler. * see previous commit * started working on lattice clusters * Tessellation tools: clusters Fixes #257 working on LatticeCluster. LatticeBasis constructor is allocating for obscure reasons. This is probably not a performance issue since this shouldn't be in performance critical parts of the code. * Tessellation tools: clusters Fixes #257 basic cluster lattices seem to be working. Need to write better visualization code. * added another cluster shape hexRGBW() * Tessellation tools: clusters Fixes #257 added function to create example LatticeCluster reworking draw for clusters so it is more sensible. * Tessellation tools: clusters Fixes #257 incomplete type signature on basis function for LatticeBasis was causing allocations and huge increase in computation. Fixed now. * Tessellation tools: clusters Fixes #257 variable renaming * Tessellation tools: clusters Fixes #257 changed draw functions to draw any type of lattice shape not just HexBasis1. Added Hex12RGB function to make hex12 pattern. Not working yet. * hex12RGB function appears to be working. Changed drawing functions for lattices so they will draw cell names as well as indices. fixed error in HexBasis3 basis function updated examples so hex drawings work with the new code * Tessellation tools: clusters Fixes #257 comment change * deleted include of Projections.jl since file is deleted * Tessellation tools: clusters Fixes #257 removed unused code from VisRepeatingStructures.jl * added license header * Tessellation tools: clusters Fixes #257 fixed naming error for file repeating_structure_examples.jl moved example cluster functions to the example file added more examples for creating and drawing ClusterWithProperties * fixed bug in hexrectcells. Was returning Vector{Tuple} code had changed to require Matrix{2,N} * updated all examples in repeatin_structure_examples.jl to work with cells defined as 2xN matrix instead of SVector of Tuple{Int,Int} * fixed bug in tests. Had incorrect name for hexdrawneighbors(). * Tessellation tools: clusters Fixes #257 modified Arrangement.jl to work with lattice functions. * modifying get_shapes to use lattice functions better * Tessellation tools: clusters Fixes #257 simplifying get_shapes * changed keyword radius to size for consistency * finished modifying get_shapes
- Loading branch information
Showing
16 changed files
with
396 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# MIT license | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# See LICENSE in the project root for full license information. | ||
|
||
|
||
|
||
############################################################################# | ||
drawrectlattice() = Vis.drawcells(Repeat.RectangularBasis(),50.0,SMatrix{2,4,Int64}(0,0,0,1,1,0,1,1)) | ||
export drawrectlattice | ||
|
||
"""draw the 2 ring neighbors of the hex cell at coordinates (0,0)""" | ||
drawhexneighbors() = Vis.drawcells(Repeat.HexBasis1(),50,Repeat.neighbors(Repeat.HexBasis1,(0,0),2)) | ||
export drawneighbors | ||
|
||
"""draw hex cell at coordinates (0,0) and the 1 and 2 ring neighbors""" | ||
drawhexregion() = Vis.drawcells(Repeat.HexBasis1(),50,Repeat.region(Repeat.HexBasis1,(0,0),2)) | ||
export drawhexregion | ||
|
||
"""draw hex cells that fit within a rectangular box centered at coordinates (0,0). Use fill color yellow.""" | ||
function drawhexrect() | ||
cells = Repeat.hexcellsinbox(2,2) | ||
Vis.drawcells(Repeat.HexBasis1(),50,cells,color = repeat(["yellow"],length(cells))) | ||
end | ||
export drawhexrect | ||
|
||
"""draw hex cells that fit within a rectangular box centered at coordinates (0,0). Use random fill colors selected for maximum distinguishability.""" | ||
function drawhexrectcolors() | ||
cells = Repeat.hexcellsinbox(4,4) | ||
Vis.drawcells(Repeat.HexBasis1(),30,cells) | ||
end | ||
export drawhexrectcolors | ||
|
||
""" Create a LatticeCluser with three elements at (0,0),(-1,0),(-1,1) coordinates in the HexBasis1 lattice""" | ||
function hex3cluster() | ||
clusterelts = SVector((0,0),(-1,0),(-1,1)) | ||
eltlattice = HexBasis1() | ||
clusterbasis = LatticeBasis(( -1,2),(2,-1)) | ||
return LatticeCluster(clusterbasis,eltlattice,clusterelts) | ||
end | ||
export hex3cluster | ||
|
||
""" Create a ClusterWithProperties with three types of elements, R,G,B """ | ||
function hex3RGB() | ||
clusterelements = SVector((0,0),(-1,0),(-1,1)) | ||
colors = [color("red"),color("green"),color("blue")] | ||
names = ["R","G","B"] | ||
eltlattice = HexBasis1() | ||
clusterbasis = LatticeBasis(( -1,2),(2,-1)) | ||
lattice = LatticeCluster(clusterbasis,eltlattice,clusterelements) | ||
properties = DataFrame(Color = colors, Name = names) | ||
return ClusterWithProperties(lattice,properties) | ||
end | ||
export hex3RGB | ||
|
||
""" Create a ClusterWithProperties with four types of elements, R,G,B,W """ | ||
function hexRGBW() | ||
clusterelements = SVector((0,0),(-1,0),(-1,1),(0,-1)) | ||
colors = [color("red"),color("green"),color("blue"),color("white")] | ||
names = ["R","G","B","W"] | ||
eltlattice = HexBasis1() | ||
clusterbasis = LatticeBasis((0,2),(2,-2)) | ||
lattice = LatticeCluster(clusterbasis,eltlattice,clusterelements) | ||
properties = DataFrame(Color = colors, Name = names) | ||
return ClusterWithProperties(lattice,properties) | ||
end | ||
export hexRGBW | ||
|
||
function hex12RGB() | ||
clusterelements = SVector( | ||
(-1,1),(0,1), | ||
(-1,0),(0,0),(1,0), | ||
(-1,-1),(0,-1),(1,-1),(2,-1), | ||
(0,-2),(1,-2),(2,-2) | ||
) | ||
red = color("red") | ||
grn = color("green") | ||
blu = color("blue") | ||
colors = [ | ||
grn,blu, | ||
blu,red,grn, | ||
red,grn,blu,red, | ||
blu,red,grn | ||
] | ||
names = [ | ||
"G3","B0", | ||
"B2","R1","G2", | ||
"R0","G1","B1","R3", | ||
"B3","R2","G0" | ||
] | ||
eltlattice = HexBasis3() | ||
clusterbasis = LatticeBasis((2,2),(-3,2)) | ||
lattice = LatticeCluster(clusterbasis,eltlattice,clusterelements) | ||
properties = DataFrame(Color = colors, Name = names) | ||
return ClusterWithProperties(lattice,properties) | ||
end | ||
export hex12RGB | ||
|
||
""" draw 3 repeats of hex3RGB cluster """ | ||
drawhex3RGB() = Vis.draw(hex3RGB(),[0 1 0; 0 0 1]) | ||
export drawhex3RGB | ||
|
||
""" draw 3 repeats of hex12RGB cluster """ | ||
drawhex12RGB() = Vis.draw(hex12RGB(),[0 1 0; 0 0 1]) | ||
export drawhex12RGB | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.