Hi c.

Thanks for the code I will test and learn more about the msh package.

For sure I will contribute my code, I was thinking of making a
package, but if it can be merged to an existing one, that is great.

JPi


On Thu, Oct 21, 2010 at 3:57 PM, c. <carlo.defa...@gmail.com> wrote:
>
> On 21 Oct 2010, at 15:20, JuanPi wrote:
>
>> Hi c.
>>
>> It may be that there is a difference. I cannot fully understand the
>> way you use the ismember function. To me, it looks you are comparing a
>> matrix with integer numbers (the triangle vertices) against a logical
>> matrix with 1's where the vertex of a triangle is inside the region or
>> in the border. I just read the help of ismember and this will just
>> give you the triangles that have the vertex "1". Am I right? Here a
>> simplified example
>>
>> % an abstract triangulation in your format
>> A = [1 2 3; 2 4 3; 4 5 3]';
>> % the result of the distance test: vertex 3 and 1 are inside the region
>> res = [1 0 1 0 0];
>> B = reshape(ismember(A,res),3,3)
>> B =
>>  1   0   0
>>  0   0   0
>>  0   0   0
>>
>> then the operation the functions "all" and "find" give
>> find(all(B))
>> ans = [](1x0)
>>
>> However, now that I now the function "ismember" I may think of a use
>> to it! Thanks a lot.
>
> sorry, as I said that had not been tested, I had misplaced the 'find'
> command:
> try the following:
>
>>> pkg load msh fpl
>>> msh =  msh2m_structured_mesh(linspace (0,1,100), linspace (0,1,100), 1,
>>> 1:4);
>>> xc = yc = .5; d = .1;
>>> triangles = all (reshape (ismember (msh.t (1:3, :), find ((msh.p(1,:) -
>>> xc).^2 +  (msh.p(2,:) - yc).^2 <= d^2)), size (msh.t(1:3, :))));
>>> msh.t (4, triangles) = 2;
>>> submsh = msh2m_submesh (msh, [], 2);
>>> subplot (1, 2, 1)
>>> pdemesh (msh.p, msh.e, msh.t)
>>> subplot (1, 2, 2)
>>> pdemesh (submsh.p, submsh.e, submsh.t)
>
> be careful, gnuplot would take a long time to plot this mesh, so I recommend
> doing
>
>>> close all
>>> backend ('fltk')
>
> before the plot part
>
>
>> I been checking the package mesh, it is pretty nice, but for my
>> objective, I would be force to create the .geo description of my
>> region (right?)...
>
> I'm not sure, I don't think so.
>
>> which is the result of a nonlinear mapping on the
>> unit hemisphere... no really easy, jeje. I am trying to merge alpha
>> shapes from CGAL or some functions from iso2mesh to get good meshes on
>> these deformed spherical sections; relying only on sampled points on
>> the region and its border.
>
> I'm not sure I understand what you want to do, so I am afraid I can't be of
> much help here.
> What I wanted to say is simply that, if you develop yourself some algorithms
> for handling triangular
> or tetrahedral meshes that are currently missing in msh, it woul be very
> nice if you contribute them to the community.
>
>> Thanks again
>> JPi
>
>
> c.
>



-- 
JuanPi Carbajal
-----
A neutron walks into a bar and orders a drink. It asks the bartender,
"How much?", the bartender answers, "For you, sir, no charge."
-----
www.ailab.ch/carbajal

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to