static void PathOpsTriangleOneOffTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < oneOff_count; ++index) { const SkDTriangle& triangle = oneOff[index]; SkASSERT(ValidTriangle(triangle)); for (int inner = 0; inner < 3; ++inner) { bool result = triangle.contains(triangle.fPts[inner]); if (result) { SkDebugf("%s [%d][%d] point on triangle is not in\n", __FUNCTION__, index, inner); REPORTER_ASSERT(reporter, 0); } } } }
static void PathOpsTriangleUtilitiesTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < tests_count; ++index) { const SkDTriangle& triangle = tests[index]; SkASSERT(ValidTriangle(triangle)); bool result = triangle.contains(inPoint[index]); if (!result) { SkDebugf("%s [%d] expected point in triangle\n", __FUNCTION__, index); REPORTER_ASSERT(reporter, 0); } result = triangle.contains(outPoint[index]); if (result) { SkDebugf("%s [%d] expected point outside triangle\n", __FUNCTION__, index); REPORTER_ASSERT(reporter, 0); } } }
bool CBasePoly::GetTriangles( CMoArray<CBasePoly*> &polies ) { uint32 i, i1, i2; CReal area; RestartLoop:; if( m_Indices > 3 ) { for( i=0; i < m_Indices; i++ ) { i1 = m_Indices.NextI( i ); i2 = m_Indices.NextI( i1 ); // Get rid of collinear vertices. area = g_TriArea2( Normal(), Pt(i), Pt(i1), Pt(i2) ); if( (area >= -0.1f) && (area <= 0.1f) ) { m_Indices.Remove( i1 ); goto RestartLoop; } if( ValidTriangle(i, i1, i2) ) { polies.Append( new CBasePoly(m_pBrush, m_Indices[i], m_Indices[i1], m_Indices[i2], true) ); m_Indices.Remove( i1 ); goto RestartLoop; } } } if( m_Indices == 3 ) { area = g_TriArea2( Normal(), Pt(0), Pt(1), Pt(2) ); if( area <= -0.1f ) polies.Append( new CBasePoly(m_pBrush, m_Indices[0], m_Indices[1], m_Indices[2], true) ); } return true; }