Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dbrayford

macrumors member
Original poster
Feb 22, 2010
41
0
I am getting the error message error: no matching function for call to 'OurFooGLView::normalx(vertex_t*&, vector_t&)'

The function takes is
Code:
void OurFooGLView::normalx(vertex_tr ver[3], vector_tr vec)

I can't see how the inputs to the functions have references

from this function call:
Code:
int IntersectionEngineCPP::computeintersectionsMoo(vertex_t verts[3], VoxelCPP * myVoxel)
{
control->OGL->normalx(verts, vecNormalxx);
}

Where the header file is:

Code:
class vertex_t
{
public:
	float x; 
	float y; 
	float z;
	
	vertex_t(float x = 0.0f, float y = 0.0f, float z = 0.0f);
};

class vector_t
{
public:
	float x; 
	float y; 
	float z;
	
	vector_t(float x = 0.0f, float y = 0.0f, float z = 0.0f);
};

class FracControllerCPP;

class IntersectionEngineCPP
{
private:
	// controller
	FracControllerCPP * control;
	
	vector_t vecNormalxx;
	vertex_t P0;
	vector_t nn;
	plane_t Pl;
	
public:
	
	IntersectionEngineCPP();
		
	int computeintersectionsMoo(vertex_t verts[3], VoxelCPP * myVoxel);
	
};

and the function is:
Code:
void OurFooGLView::normalx(vertex_tr ver[3], vector_tr vec)
{
    vector_tr a, b;
	
    // calculate the vectors A and B
    // note that v[3] is defined with counterclockwise winding in mind
    // a
    a.x = ver[0].x - ver[1].x;
    a.y = ver[0].y - ver[1].y;
    a.z = ver[0].z - ver[1].z;
    // b
    b.x = ver[1].x - ver[2].x;
    b.y = ver[1].y - ver[2].y;
    b.z = ver[1].z - ver[2].z;
	
    // calculate the cross product and place the resulting vector
    // into the address specified by vertex_tr *normal
    vec.x = (a.y * b.z) - (a.z * b.y);
    vec.y = (a.z * b.x) - (a.x * b.z);
    vec.z = (a.x * b.y) - (a.y * b.x);
	
    // normalize
    // calculate the length of the vector
    float len = (float)(sqrt((vec.x * vec.x) + (vec.y * vec.y) + (vec.z * vec.z)));
	
    // avoid division by 0
    if (len == 0.0f)
        len = 1.0f;
	
    // reduce to unit size
    vecNorm.x = vec.x / len;
    vecNorm.y = vec.y / len;
    vecNorm.z = vec.z / len;
}
 
What type is vertex_tr?

The red-hilited type differs from the blue-hilited type:
The function takes is
Code:
void OurFooGLView::normalx([COLOR="Red"]vertex_tr[/COLOR] ver[3], vector_tr vec)

I can't see how the inputs to the functions have references

from this function call:
Code:
int IntersectionEngineCPP::computeintersectionsMoo([COLOR="Blue"]vertex_t[/COLOR] verts[3], VoxelCPP * myVoxel)
{
control->OGL->normalx(verts, vecNormalxx);
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.