[SU]Ray Hit Test in Ruby

Reference : http://www.sketchup.com/intl/en/developer/docs/ourdoc/model#raytest

Model.raytest (compatible with SketchUp 6.0+)
raytest 메소드는 광선(직선)을 모델에 비추는 데에 사용되며, 그 광선이 부딪히는 첫번째 대상을 반환한다.

광선(ray)은 한 점과 한 벡터를 가지고 있는 배열이다[Geom::Point3d(), Geom::Vector3d()]. 그 점은 광선의 시작점을 정의하며, 그 벡터는 방향을 정의한다. 만약 방향벡터가 정규화될 수 없다면(예를 들어 direction = [0, 0, 0]), 방향벡터는 광선의 교점으로 간주한다.

NOTE: 매개변수 wysiwyg_flag는 SU8 M1에서부터 포함되었다.

매개변수:

ray(광선)
한 점과 한 벡터로 구성된 배열
wysiwyg_flag
An optional boolean, added in SU8 M1, indicating whether or not to consider hidden geometry in intersect computations. If this flag is not specified, it defaults to true (WYSIWYG) – i.e. hidden geometry is not intersected against.

반환값:

item
두 개의 값을 가진 배열. 첫번째 값은 광선이 통과하는 점(Point3d의 변수유형)이다. 두번째 요소는 광선이 부딪히는 모든 개체들의 배열이다. 예를 들어, For example, if the ray hits a face that contained by a component instance the instance path would be [Component1]. If the ray hit a face that is contained by a component instance, which is contained by another component instance and so on, the instance path would be [Component1, Component2, Component3…].