Comments (6)
These are the profile vertices:
[0] {0,02300000 -0,50000000}
[1] {0,03100000 -0,58900000}
[2] {0,04700000 -0,71000000}
[3] {0,06500000 -0,82600000}
[4] {0,08600000 -0,93500000}
[5] {0,11000000 -1,03600000}
[6] {0,13600000 -1,12900000}
[7] {0,16400000 -1,21300000}
[8] {0,19400000 -1,28700000}
[9] {0,22600000 -1,35100000}
[10] {0,25900000 -1,40400000}
[11] {0,29300000 -1,44500000}
[12] {0,32800000 -1,47500000}
[13] {0,36300000 -1,49300000}
[14] {0,39900000 -1,50000000}
[15] {0,47100000 -1,49300000}
[16] {0,54200000 -1,47500000}
[17] {0,61200000 -1,44500000}
[18] {0,68000000 -1,40400000}
[19] {0,74600000 -1,35100000}
[20] {0,80900000 -1,28700000}
[21] {0,86900000 -1,21300000}
[22] {0,92500000 -1,12900000}
[23] {0,97700000 -1,03600000}
[24] {1,02500000 -0,93500000}
[25] {1,06700000 -0,82600000}
[26] {1,10400000 -0,71000000}
[27] {1,13500000 -0,58900000}
[28] {1,15300000 -0,50000000}
from geometry3sharp.
When inspecting the mesh, this caught my eye:
These two vectors shouldn't have y=0
, the whole mesh shouldn't be in that range.
Debugging the TubeGenerator
class, I found that the 4890
and 4891
indices are exactly between the nBottomC
and nStartB
variables passed in append_disc(Slices, nBottomC, nStartB, true, Clockwise, ref ti);
from geometry3sharp.
Well, the caps are made by creating a triangle fan around a "center" vertex, and currently that center vertex is defined as the start/end points of the path curve, projected into the start/end Frames. So, if the 2D projection of those points is not inside your profile polygon, then the fan will be nonsense. From what I can see your profile doesn't contain the origin, so that's my guess for what is going wrong here...
To cap an arbitrary polygon, it has to be triangulated, and I don't have a great arbitrary-polygon-triangulator yet. TriangulatedPolygonGenerator may work.
Your profiles look like they are convex, in which case the fan triangulation would work if the center point ended up inside the profile. If you translate your profile, it might resolve it. I will try to add in the ability to either specify or re-calculate a better cap center-point...
from geometry3sharp.
Thanks, that's really clarifying.
My profiles are indeed convex. I actually had tried translating them to have origin inside but then my normals in the mesh became all wrong, I'm stacking several closed loop tubes and the environment map is restarting at each tube.
I've tried translating y-s of the normals to compensate for the translated profile. I'm pretty sure this is a very naive approach, I don't have much knowledge of how normals work. While the outcome looks quite okay (environment map not restarting) there's something off with the normals and I can't figure out exactly what.
from geometry3sharp.
Added TubeGenerator.CapCenter, if you set this to centroid of your polygons then you don't have to translate them.
Normals aren't really meant to be translated - they represent directions, so "translating" the values in a normal means pointing them in some other direction.
The generator is setting the normals as if the profile were a circle, which is wrong, and extra-wrong if your profile is shifted from the origin. Calculating 'correct' normals for an arbitrary profile is somewhat difficult. I would suggest instead calling MeshNormals.QuickCompute() on the output DMesh3, that will re-calculate averaged vertex normals.
from geometry3sharp.
Thank you so much, your help has been very helpful and clarifying.
The new CapCenter
works really well.
from geometry3sharp.
Related Issues (20)
- Convert mesh regions to 2d, alter in 2d, push back into 3d mesh
- Is this project dead? HOT 1
- Get brick materials right
- Fix hover info on bricks
- Rewrite right pointer (PLEASE!) HOT 1
- Mesh expansion and comparison
- Refactor cursor3d
- Refactor HandR and HandL to use input action class
- Write playmode tests for right pointer flow
- Rider clean project to adjust line length
- Break up LDrawConfig into different classes
- Refactor BrickMaterialsLoader (PLEASE!!!)
- Example of mesh volume calculation HOT 3
- 这个可以做曲面拟合吗?
- Can this be used for surface fitting?
- Narrow band SDF generation from meshes is adding a shell to objects HOT 1
- Minkowski sum 3D
- Get closest vertex on mesh surface HOT 2
- Boolean operations on polygons and polyhedra?
- Quadratic Bezier Curves HOT 1
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 geometry3sharp.