Giter Club home page Giter Club logo

Comments (2)

fangq avatar fangq commented on August 21, 2024

@tmedani, sorry for the delay.

the reason you got 0 labels in some of the regions was because your seeds were not generated properly.

because in this case, 3 of the surfaces are enclosed by the outer layer, therefore, raysurf.m may not return the seed that is specific for a given region.

raysurf.m works by shooting a ray across a closed surface, finding a pair of intersection points, and use the mid-point as the seed. This only works when a closed surface is not enclosed/enclosing another surface - because the mid-point may be inside the surface being enclosed.

to do this properly, you need to use something like below:

%% define seeds along the electrode axis
[t,baryu,baryv,faceidx]=raytrace(orig,v0,allnode,allface);
t=sort(t(faceidx));
t=(t(1:end-1)+t(2:end))*0.5;
seedlen=length(t);
seeds=repmat(orig(:)',seedlen,1)+repmat(v0(:)',seedlen,1).*repmat(t(:)-1,1,3);

where the allnode/allface are the combined surfaces of the 3 layers. The raytrace call returns all intersection points with distance from the ray origin (orig) stored in t. So, the mid-point of every segment between adjacent intersection points defines a seed that belongs to a specific region.

Please give above code a try and let me know if you need me to explain this further.

from iso2mesh.

tmedani avatar tmedani commented on August 21, 2024

Dear @fangq
Thank you for your answer and no worry for the delay ;)

I tried your solution, it works fine, thanks.

However, since I have three surfaces (in this example), I tried just to use the 3 upper points,
in this case, the label 0 is still here.
So I took the whole 6 points (length(t)) and the outputs are perfect.

I changed the last line to :
seeds=repmat(orig(:)',seedlen,1)+repmat(v0(:)',seedlen,1).*repmat(t(:),1,3);

I removed the (-1)

Thank you again for your help.

Kind regards
Takfarinas

from iso2mesh.

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.