CSamplePhantomObject()
	{
		ON_3fPoint v[] = 
		{
			ON_3fPoint(0.0, 0.0, 0.0),
			ON_3fPoint(1.0, 0.0, 0.0),
			ON_3fPoint(1.0, 1.0, 0.0),
			ON_3fPoint(0.0, 1.0, 0.0),
			ON_3fPoint(0.0, 0.0, 1.0),
			ON_3fPoint(1.0, 0.0, 1.0),
			ON_3fPoint(1.0, 1.0, 1.0),
			ON_3fPoint(0.0, 1.0, 1.0)
		};

		m_mesh.m_V.Append(_countof(v), v);

		ON_MeshFace f[]=
		{
			{0, 1, 2, 3},
			{0, 1, 1 + 4, 0 + 4},
			{1, 2, 2 + 4, 1 + 4},
			{2, 3, 3 + 4, 2 + 4},
			{3, 0, 0 + 4, 3 + 4},
			{7, 6, 5, 4}
		};
		
		m_mesh.m_F.Append(_countof(f), f);

		m_mesh.ComputeVertexNormals();
		m_mesh.ComputeFaceNormals();

		m_geometry = &m_mesh;
		m_geomem_type = 1;
	}
Пример #2
0
int PointIndex::InsertPoint(
    ON_3dPoint P
    )
{
    /* This will eventually be implemented in a much more efficient way */
    for (int i = 0; i < mesh->m_V.Count(); i++) {
	if (VNEAR_EQUAL(mesh->m_V[i], P, tol)) {
	    return i;
	}
    }
    mesh->m_V.Append(ON_3fPoint(P));
    return mesh->m_V.Count();
}
Пример #3
0
int main()
{
    /* create the points */
    ON_3fPoint a1 = ON_3fPoint(1.0, 1.0, -1.0);
    ON_3fPoint b1 = ON_3fPoint(1.0, 1.0, 1.0);
    ON_3fPoint c1 = ON_3fPoint(-1.0, 1.0, 1.0);
    ON_3fPoint d1 = ON_3fPoint(-1.0, 1.0, -1.0);
    ON_3fPoint e1 = ON_3fPoint(1.0, -1.0, -1.0);
    ON_3fPoint f1 = ON_3fPoint(1.0, -1.0, 1.0);
    ON_3fPoint g1 = ON_3fPoint(-1.0, -1.0, 1.0);
    ON_3fPoint h1 = ON_3fPoint(-1.0, -1.0, -1.0);
    ON_3fPoint a2 = ON_3fPoint(0.5, 2.0, -0.5);
    ON_3fPoint b2 = ON_3fPoint(0.5, 2.0, 0.5);
    ON_3fPoint c2 = ON_3fPoint(-0.5, 2.0, 0.5);
    ON_3fPoint d2 = ON_3fPoint(-0.5, 2.0, -0.5);
    ON_3fPoint e2 = ON_3fPoint(0.5, -2.0, -0.5);
    ON_3fPoint f2 = ON_3fPoint(0.5, -2.0, 0.5);
    ON_3fPoint g2 = ON_3fPoint(-0.5, -2.0, 0.5);
    ON_3fPoint h2 = ON_3fPoint(-0.5, -2.0, -0.5);

    /* create the meshes */
    ON_Mesh mesh1;
    mesh1.m_V.Empty();
    mesh1.m_F.Empty();
    ON_Mesh mesh2;
    mesh2.m_V.Empty();
    mesh2.m_F.Empty();

    /* put the points in the meshes */
    mesh1.m_V.Append(a1);
    mesh1.m_V.Append(b1);
    mesh1.m_V.Append(c1);
    mesh1.m_V.Append(d1);
    mesh1.m_V.Append(e1);
    mesh1.m_V.Append(f1);
    mesh1.m_V.Append(g1);
    mesh1.m_V.Append(h1);
    mesh2.m_V.Append(a2);
    mesh2.m_V.Append(b2);
    mesh2.m_V.Append(c2);
    mesh2.m_V.Append(d2);
    mesh2.m_V.Append(e2);
    mesh2.m_V.Append(f2);
    mesh2.m_V.Append(g2);
    mesh2.m_V.Append(h2);

    /* create the faces */
    ON_MeshFace abcd = {{0, 1, 2, 3}};
    ON_MeshFace efba = {{4, 5, 1, 0}};
    ON_MeshFace ehgf = {{4, 7, 6, 5}};
    ON_MeshFace dcgh = {{3, 2, 6, 7}};
    ON_MeshFace adhe = {{0, 3, 7, 4}};
    ON_MeshFace bfgc = {{1, 5, 6, 2}};

    /* put the faces in the meshes */
    mesh1.m_F.Append(abcd);
    mesh1.m_F.Append(efba);
    mesh1.m_F.Append(ehgf);
    mesh1.m_F.Append(dcgh);
    mesh1.m_F.Append(adhe);
    mesh1.m_F.Append(bfgc);
    mesh2.m_F.Append(abcd);
    mesh2.m_F.Append(efba);
    mesh2.m_F.Append(ehgf);
    mesh2.m_F.Append(dcgh);
    mesh2.m_F.Append(adhe);
    mesh2.m_F.Append(bfgc);

    /* and now for the action */
    ON_ClassArray<ON_Polyline> out;

    /* int rv = MeshMeshIntersect(&mesh1, &mesh2, &out, 1.0e-10); */
    /* assert(rv == 2); */
}