I am getting the error message error: no matching function for call to 'OurFooGLView::normalx(vertex_t*&, vector_t&)'
The function takes is
I can't see how the inputs to the functions have references
from this function call:
Where the header file is:
and the function is:
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;
}