-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from cserteGT3/initial-design
Transition initial design from closed source code
- Loading branch information
Showing
23 changed files
with
88,855 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/Manifest.toml | ||
/docs/Manifest.toml | ||
/docs/build/ | ||
*.bat |
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 |
---|---|---|
|
@@ -3,7 +3,21 @@ uuid = "dc39d501-6ffa-4c27-9708-7dc7e3b1a5c3" | |
authors = ["Tamás Cserteg <[email protected]>", "András Kovács <[email protected]> and contributors"] | ||
version = "1.0.0-DEV" | ||
|
||
[deps] | ||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" | ||
JuMP = "4076af6c-e467-56ae-b986-b466b2749572" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" | ||
Meshes = "eacbb407-ea5a-433e-ab97-5258b1ca43fa" | ||
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" | ||
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" | ||
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc" | ||
|
||
[compat] | ||
DataFrames = "1" | ||
JuMP = "1.4" | ||
Meshes = "0.32" | ||
PrettyTables = "2" | ||
julia = "1.6" | ||
|
||
[extras] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Using the API to extend the geometry types | ||
|
||
The solver handles hole and face (plane) features that are either [`IsPrimitive`](@ref) or [`IsFreeForm`](@ref). | ||
A few basic types are defined like [`SimpleHole`](@ref) and [`MeshHole`](@ref), but new ones can be also defined. | ||
For example for point clouds, that don't have faces, like a mesh, only points. | ||
|
||
This capability is properly documented, as a major API rewrite is going on in [#3](https://github.com/cserteGT3/BlankLocalizationCore.jl/pull/3). | ||
|
||
## Defining a new geometry | ||
|
||
Defining a new geometry is pretty easy: | ||
|
||
* It has to be the subtype of either [`AbstractHoleGeometry`](@ref) or [`AbstractPlaneGeometry`](@ref). | ||
* The [`GeometryStyle`](@ref) trait is need to be defined: it is either a [`IsPrimitive`](@ref) or [`IsFreeForm`](@ref) geometry. | ||
* `IsFreeForm` geometries need to define the [`surfacepoints`](@ref) and [`filteredsurfacepoints`](@ref) functions. | ||
* `IsPrimitive` geometries need to define the [`featurepoint`](@ref) functions | ||
* Those `IsPrimitive` geometries that are subtype of `AbstractHoleGeometry` also need to define the [`featureradius`](@ref) function | ||
* Finally, for visualization purposes the [`visualizationgeometry`](@ref) function should be defined, that returns an object, that can be used with the `Meshviz.viz()` function. | ||
|
||
## An example | ||
|
||
Let's assume that we want to define a new holelike type: `MyDisk`, which has a featurepoint, a normal, and a radius. | ||
|
||
```julia | ||
using BlankLocalizationCore | ||
|
||
struct MyDisk <: AbstractHoleGeometry | ||
point::Vector{Float64} | ||
normal::Vector{Float64} | ||
diameter::Float64 | ||
end | ||
|
||
GeometryStyle(::Type{MyDisk}) = IsPrimitive() | ||
``` | ||
|
||
It is an `IsPrimitive` and holelike feature, therefore we need to define the: | ||
|
||
* `featurepoint` | ||
* `featureradius` | ||
* `visualizationgeometry` | ||
|
||
functions. | ||
These look like as follows: | ||
|
||
```julia | ||
featurepoint(::IsPrimitive, x::MyDisk) = x.point | ||
featureradius(::IsPrimitive, x::MyDisk) = x.diameter/2 | ||
|
||
using Meshes | ||
|
||
function visualizationgeometry(geom::MyDisk) | ||
plane = Plane(Point3(geom.point), Vec3(geom.normal)) | ||
return Disk(plane, geom.diameter/2) | ||
end | ||
|
||
``` |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.