Encapsulate() 공개 메소드

Grow the region to include the specified point
public Encapsulate ( int x, int z ) : void
x int /// A ///
z int /// A ///
리턴 void
예제 #1
0
	/// <summary>
	/// Get the currently visible region
	/// </summary>
	/// <returns>
	/// A <see cref="Region"/>
	/// </returns>
	public Region GetVisibleRegion()
	{
		// initialize using point in lower left corner
		m_intersectionPoint = coordDnLeft;
		Region region = new Region(
		                           Mathf.FloorToInt(m_intersectionPoint.x),
		                           Mathf.CeilToInt(m_intersectionPoint.x),
		                           Mathf.CeilToInt(m_intersectionPoint.z),
		                           Mathf.FloorToInt(m_intersectionPoint.z)
		                           );
		// grow the region to include each corner
		m_intersectionPoint = coordUpLeft;
		region.Encapsulate(Mathf.FloorToInt(m_intersectionPoint.x), Mathf.CeilToInt(m_intersectionPoint.z));
		m_intersectionPoint = coordUpRight;
		region.Encapsulate(Mathf.CeilToInt(m_intersectionPoint.x), Mathf.CeilToInt(m_intersectionPoint.z));
		m_intersectionPoint = coordDnRight;
		region.Encapsulate(Mathf.CeilToInt(m_intersectionPoint.x), Mathf.FloorToInt(m_intersectionPoint.z));
		// return the results
		return region;
	}