Ejemplo n.º 1
0
float C3DLine::LineLength()
{
	float length = 0.0f;

	for ( int i=0; i<(int)m_Segments.size(); i++)
	{
		float segLen =  segmentLength(m_vertices[m_Segments[i].a], m_vertices[m_Segments[i].b]);
		length += length + segLen;
	}

	return length;
}
Ejemplo n.º 2
0
float Patch::size() const
{
	return .25f * (segmentLength(0) + segmentLength(1) + segmentLength(2) + segmentLength(3));
}
Ejemplo n.º 3
0
bool C3DLine::HitTest(CVector3D rayCast[], float radius)
{
	//these should be separate functions

	// now we can run our hit test on our vertices
	for(int i=0; i<(int)m_vertices.size();i++)
	{
		bool hit = m_vertices[i].hitTest(rayCast, m_fPointSize);

		if (hit == TRUE)
		{
			m_VertCol[i] = m_VertCol[i].set(m_selCol);
			m_iVertID = i;

			// make sure there is no selected edge
			if (m_iSegID != m_iMaxSegs)
			{
				m_segmentCol[m_iSegID] = m_segmentCol[m_iSegID].set(m_LineCol);
				m_iSegID = m_iMaxSegs;
			}
			return TRUE;
		}
		else
		{
			m_VertCol[i] = m_VertCol[i].set(m_PointCol);

			m_iVertID = m_iMaxVerts;
		}
	}

	rayCast[0].z = 0.0f;

	// now we can run our hit test on our segments
	for (int i=0; i<(int)m_Segments.size();i++)
	{


		CVector3D check = ClosestPoint(rayCast[0], i);
		float distance = segmentLength(rayCast[0], check);

		float segLength = segmentLength(m_vertices[m_Segments[i].a], m_vertices[m_Segments[i].b]);
		float slA = segmentLength(m_vertices[m_Segments[i].a], check);
		float slB = segmentLength(m_vertices[m_Segments[i].b], check);


		if (distance < 4.0f && slA < segLength && slB < segLength)
		{
			if (m_iVertID == m_iMaxVerts)
			{
				m_segmentCol[i] = m_segmentCol[i].set(m_selCol);
				m_iSegID = i;

				break;
			}
		}
		else
		{
			m_segmentCol[i] = m_segmentCol[i].set(m_LineCol);
			m_iSegID = m_iMaxSegs;
		}
	}

	return FALSE;
}