Home
Reply
Regular Contributor
xpz
Posts: 46

How to query face mesh points by a 2D array sequence

We know that a face can be described by u, v parameters. So, we would like to mesh a surface by uniform u, v segments, for example, 10 segments in u, v direction separately.

 

After meshing, we want to the get the mesh points as a 2D array, which goes u firstly, then v. After that, we can use this array by a loop:

 

for( iv = 1~10)

  for( iu=1~10)

  end

end

 

What kind of mesh query method can do that? Can anybody provide us an example code?

 

Thanks.

Regular Contributor
Vi2
Posts: 55

Re: How to query face mesh points by a 2D array sequence

 

const surface & surf = <pFACE>->geometry().equation();
SPApar_pos uvpos;
SPAposition pos;

for (int iv = 0; iv <= Nv; iv++)
{
	uvpos.v = surf.param_range_v().interpolate(double(iv)/Nv);
	for (int iu = 0; iu <= Nu; iu++)
	{
		uvpos.u = surf.param_range_u().interpolate(double(iu)/Nu);
		
		pos = surf.eval_position(uvpos);
		
		<2DArray>.append(pos);
	}
}
 
Regular Contributor
xpz
Posts: 46

Re: How to query face mesh points by a 2D array sequence

Get it, thanks.