void Subdivider::samplingSplit( Bin& source, Patchlist& patchlist, int subdivisions, int param ) { if( ! source.isnonempty() ) return; if( patchlist.cullCheck() == CULL_TRIVIAL_REJECT ) { freejarcs( source ); return; } patchlist.getstepsize(); if( renderhints.display_method == N_OUTLINE_PATCH ) { tessellation( source, patchlist ); outline( source ); freejarcs( source ); return; } //patchlist.clamp(); tessellation( source, patchlist ); if( patchlist.needsSamplingSubdivision() && (subdivisions > 0) ) { if( ! patchlist.needsSubdivision( 0 ) ) param = 1; else if( ! patchlist.needsSubdivision( 1 ) ) param = 0; else param = 1 - param; Bin left, right; REAL mid = ( patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1] ) * 0.5; split( source, left, right, param, mid ); Patchlist subpatchlist( patchlist, param, mid ); samplingSplit( left, subpatchlist, subdivisions-1, param ); samplingSplit( right, patchlist, subdivisions-1, param ); } else { setArcTypePwl(); setDegenerate(); nonSamplingSplit( source, patchlist, subdivisions, param ); setDegenerate(); setArcTypeBezier(); } }
void TestVoronoiTessellationUsesOverriddenMetric() throw (Exception) { unsigned cells_across = 6; unsigned cells_up = 12; double crypt_width = 6.0; unsigned thickness_of_ghost_layer = 0; CylindricalHoneycombMeshGenerator generator(cells_across, cells_up,thickness_of_ghost_layer, crypt_width/cells_across); Cylindrical2dMesh* p_mesh = generator.GetCylindricalMesh(); TS_ASSERT_EQUALS(p_mesh->CheckIsVoronoi(), true); // Create Voronoi tessellation VertexMesh<2, 2> tessellation(*p_mesh); // Get two neighbouring nodes on boundary 48 and 53. // Check that they have a common edge // check it is a reasonable length (O(1)?) c_vector<double, 2> location_48 = p_mesh->GetNode(48)->rGetLocation(); double common_edge_between_48_and_53 = tessellation.GetEdgeLength(48, 53); TS_ASSERT_DELTA(tessellation.GetEdgeLength(48, 49), pow(3.0, -0.5), 1e-4); TS_ASSERT_DELTA(common_edge_between_48_and_53, pow(3.0, -0.5), 1e-4); // Check that both cells have a reasonable sized area TS_ASSERT_DELTA(tessellation.GetVolumeOfElement(44), 0.5 * pow(3.0, 0.5), 1e-4); TS_ASSERT_DELTA(tessellation.GetSurfaceAreaOfElement(44), 2 * pow(3.0, 0.5), 1e-4); TS_ASSERT_DELTA(tessellation.GetVolumeOfElement(48), 0.5 * pow(3.0, 0.5), 1e-4); TS_ASSERT_DELTA(tessellation.GetSurfaceAreaOfElement(48), 2 * pow(3.0, 0.5), 1e-4); }