CRect:Inflate CRect:Normalize

CRect:Intersection


The Intersection method creates the intersection of this CRect with another CRect. The resulting CRect has the smallest absolute extent in each dimension.

Syntax

CRect:Intersection( CRect2 )

  • where CRect2 is another CRect object.

Example

The following script replaces CRect R with its intersection with CRectR2:

R = CRect:new()

-- create a CRect object

R:Set(100, 200, 300, 600)

 

R2 = CRect:new()

-- create another CRect object

R2:Set(-100, 250, 200, 800)

 

R:Intersection( R2 )

-- updates R, does not change R2

Printf("%lg:%lg, %lg:%lg\n", R:Get())

-- result: 100:200, 300:600.

Related Topics

CRect, Union, Offset, Inflate