Open YoungRainy opened 5 years ago
Also, in "SphericalGeometry.h" file, line 167, the struct "PlannarSources", The index is repeated twice, but this index is shared with?
Thank you, I am new for this area. it would be very grateful if you can help me with this.
sourceID is the index of the triangle that is being intersected against the grid. The clipping is done by intersecting the triangle with the planes bounding the sides of the cell. For each vertex of the input polygon, we determine if it's in front of, behind, or on the clipping plane.
Not sure I follow the question about PlanarSources.
Thank you for your patience. Here is part of the class "Polygon"
template< class Real >
class Polygon
{
public:
struct PlanarSources
{
int idx[2];
PlanarSources( void ){ idx[0] = idx[1] = -1; }
static int SharedIndex( const PlanarSources &ps1 , const PlanarSources &ps2 )
{
if( ps1.idx[0]>=0 )
if( ps1.idx[0]==ps2.idx[0] || ps1.idx[0]==ps2.idx[1] ) return ps1.idx[0];
else if( ps1.idx[1]>=0 ) if( ps1.idx[1]==ps2.idx[0] || ps1.idx[1]==ps2.idx[1] ) return ps1.idx[1];
return -1;
}
void addIndex( int i )
{
if ( idx[0]==-1 ) idx[0] = i;
else if( idx[1]==-1 ) idx[1] = i;
else if( i>=0 ) fprintf( stderr , "[WARNING] PlanarSources::addIndex: both indices assigned: %d %d <- %d\n" , idx[0] , idx[1] , i );
}
bool full( void ) const { return idx[1]>=0; }
};
as you can see, in the struct, PlanarSources,
int idx[2]
with the function addIndex(int i)
, idx[0] == i
, after it is called the first time, then idx[1] = i
, then the function full
will be true? This is where I am confused, and the sharedIndex
?
After it's called the first time, idx[0]=i, idx[1]=-1 => full() = false After it's called the second time, idx[1]=i -> full() = true The point is that when you have a vertex on a clipped triangle it can be one of three cases:
Thank you so much. I am going to read more now.
So, here, the PlanarSources is used to describe the vertices on the triangle.
As in the above image, the blue points are PlanarSources, the SourceID is the index of the black triangle, The "Polygon" also means this triangle? is it right?
But in the class "Polygon", it has properity,
public:
int sourceID, theta, phi;
"theta" and "phi" , they are all singular, which is conflict with what I said above. so, i am lost.
Singular? In the image, you are missing a bunch of blue vertices -- the ones that are the vertices of the lattice with the triangle. (These will have two planar sources. Most of the ones you've marked have only one. The original vertices gave zero.)
I mean:
here, the variable int theta, phi,
, is not vector<int> thetas, phis.
For a given clipped polygon, (theta,phi) gives the index of the spherical cell in which the clipped polygon resides.
I start a new issue for asking a new question. In "SphericalGeometry.inl", line 582, The code is like this:
I believed this function is used to calculate the vertices when the triangle mesh intersects the grid. But I don't get the meaning of the "sourceID", and what's the states of "front, back, or boundary"? Does it mean the direction of the plane? if it is, the boundary means the vertice is on the boundary of the plane?