Giter Club home page Giter Club logo

Comments (6)

sandord avatar sandord commented on August 19, 2024

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.

sandord avatar sandord commented on August 19, 2024

When inspecting the mesh, this caught my eye:

image

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.

rms80 avatar rms80 commented on August 19, 2024

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.

sandord avatar sandord commented on August 19, 2024

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.

rms80 avatar rms80 commented on August 19, 2024

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.

sandord avatar sandord commented on August 19, 2024

Thank you so much, your help has been very helpful and clarifying.

The new CapCenter works really well.

from geometry3sharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.