Comments (8)
@CNOT can you please open a separate issue with this MWE? It doesn't seem related.
from meshes.jl.
This bug is now fixed. The original article contains the following theorem:
There is an additional condition on the first vertex Q1 of the segment: it must not be coplanar with the triangle. In this case, we need to swap the vertices Q1 and Q2 before running the algorithm.
A patch release in on its way.
from meshes.jl.
Thank you @jtveiten for reporting the issue. I can reproduce it.
It is a corner point intersection:
viz([s1, t1], color = ["red", "teal"])
The bug is in the intersection
result. We will investigate when we find some time. Feel free to submit a PR in the meantime.
from meshes.jl.
@dorn-gerhard did you write our intersection(::Segment, ::Triangle)
method? The fix may consist of a simple change from <
to <=
somewhere in the function body.
from meshes.jl.
Hi,
I cannot find an implementation for intersects(::Segment, ::Triangle)
in src/predicates/intersects.jl
Not sure why it returns true.
No, I haven't implemented Triangle - Segment.
I was thinking about it but a while ago using a generalization of intersectparameters
to more dimensions, then we got stuck in that discussion of #325 where I wanted to fix names for intersection Types. Then they got refactored which simplified a lot.
I think another refactoring might be necessary to consider intersection of objects of different dimensionality.
e.g. each object has an inner part, e.g. interval 0 < x < 1 and an outer part = boundary (segment end points, ray origin, edges of triangle, surface of 3d sphere).
- if a subset of the outer part with no inner points equals the intersection set it should be called
Touching
, - if a subset of inner parts with a dimensionality less the original geometry is in the intersection set, I would call it
Crossing
- if a subset of inner parts with the same dimensionality as the original geometry is in the intersection set, I would call it
Overlapping
(I would dismiss Pos and NegOverlapping as the result is clear from the intersection object (Segment vs. Ray)
Since we have two Geometries A and B in an intersection we could have combinations of these three cases above.
e.g.
- OverlappingTouching: A Segment that touches the edge of a Triangle
- OverlappingCrossing: A Segment that crosses a Triangle in plane yielding a segment
- TouchingCrossing: A Segment that crosses the origin of Ray (not parallel)
A Ray touching a corner of a Triangle (could be both also in the same plane) would be TouchingCrossing instead of CornerTouching
A Ray touching the edge of a Triangle (both not in the same plane) would also be called TouchingCrossing instead of EdgeTouching
A Ray overlapping with the edge of a Triangle (in the same plane) would be called OverlappingTouching
Not sure if CornerTouching and EdgeTouching is relevant for an algorithm.
Btw: segments, lines or rays that lie in the same plane as the triangle might not yield results:
t1 = Triangle((1.0,0.,0.),(0.,1.,0.),(0.,0.,1.))
s1 = Segment((1.0,0.,0.),(0.,1.,0.))
intersection(t1,s1)
from meshes.jl.
I cannot find an implementation for
intersects(::Segment, ::Triangle)
insrc/predicates/intersects.jl
Not sure why it returns true.
You can use the @which
macro to find the method that gets called:
julia> @which intersects(s1, t1)
intersects(c::Chain, g::Geometry)
@ Meshes ~/.julia/dev/Meshes/src/predicates/intersects.jl:64
In this case we have a general method for Chain and Geometry. You can also discover this using the VSCode debugger by typing @enter intersects(s1, t1)
and then following the steps.
I think another refactoring might be necessary.
These are very welcome. We are always doing that to improve the code organization.
Btw: segments, lines or rays that lie in the same plane as the triangle might not yield results
The intersection
is the one with the bug in this issue. You can find the method here:
Meshes.jl/src/intersections/segments.jl
Line 206 in 3f1ea5e
from meshes.jl.
I added an issue / suggestion: #734 with a better description for refactoring intersection types using inner and outer points and their dimensionality to define Overlapping, Crossing and Touching for general geometries
from meshes.jl.
I'm not sure this is the same bug, but even in the 2D case intersection/clipping
return incorrect values. Here's a MWE that I hope could be helpful for rooting out the issue:
using Meshes
using CairoMakie
cg = Meshes.CartesianGrid((0.0, 0.0), (2.0, 1.0), (0.1, 0.1))
ps = Meshes.Point2[(0.0, 0.0), (1.0, 0.5), (1.0, 1.0), (2.0, 0.0)]
pol = Meshes.PolyArea(ps)
viz(pol,showfacets = true)
for i in faces(cg, 2)
cl = i ∩ pol # Same thing happens with clip(i,pol, SutherlandHodgman())
if cl != nothing
viz!(i,showfacets = true, alpha = 0.5, facetcolor = :red)
end
end
Makie.current_figure()
from meshes.jl.
Related Issues (20)
- Idea for refactoring intersection types HOT 1
- Missing popular GIS Projections HOT 1
- Problematic polygon for `FIST` HOT 1
- Throw better error message in `signarea(triangle3D)` HOT 3
- Methods for constructing a `Cylinder` from a segment do not work. HOT 1
- Stackoverflow when discretizing a `Cone` HOT 2
- `Vec{N, T}` constructor should construct `Vec{N, T}` instance HOT 7
- Add `convert` method to `GeometrySet`
- Allow `MultiGridPath` with `SubGrid`
- Add `Affine` to docs
- Do not allow `Ngon` with N < 3 HOT 1
- Export `SubDomain` and `SubGrid`
- Measure of CylinderSurface assumes right-cylinder HOT 10
- `viz` of heterogeneous `GeometrySet` failing
- Parameterization of a Torus with `minor > major` HOT 8
- intersection/clipping not working properly in the 2D case HOT 3
- Isolines of a 2d function, e.g, (x,y) -> x^2-y^2 HOT 1
- Set elements of CartesianGrid and RectilinearGrid using `Box` instead of `Hexahedron` HOT 5
- Surface normal of a triangle should be normalized HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meshes.jl.