窗口选择资料。

 
gw.getWinSizeX()
611 --拾取当前窗口返回的值。
1230
gw.getWinSizeY()
396
800

--根据box2  拾取窗口节点,这个很是有用。
ui =boxPickNode (box2 [0,0] [1000,1000])
#($Sphere:Sphere01 @ [45.523499,34.512344,0.000000], $Sphere:Sphere02 @ [12.353422,22.442947,0.000000], $Sphere:Sphere03 @ [-11.847525,18.393448,0.000000], $Sphere:Sphere04 @ [-36.874302,25.021164,0.000000], $Sphere:Sphere05 @ [-110.771210,314.260803,0.000000], $Sphere:Sphere06 @ [-67.260963,424.976379,0.000000])

select ui
OK

-----圆形拾取方法,这个这个的建立和上面不一样。

---插入box2 的语法、

box2 的方法应用。

<Box2>.x :
Integer

<Box2>.y :
Integer

<Box2>.w :
Integer

<Box2>.h :
Integer

<Box2>.left :
Integer, alias of x property

<Box2>.right :
Integer

<Box2>.top :
Integer, alias of y property

<Box2>.bottom
: Integer

<Box2>.center
: Point2, read-only

box2 的算法可以用

<Box2> == <Box2>

<Box2> != <Box2> 是可以用逻辑判断进行判断。

scale <Box2> <float>
Scales the coordinates of the box about the center of the box.

translate <Box2> <point2>
Translates the coordinates of the box by the distance specified.

contains <Box2> <point2>
Determines if the point2 value is contained within the Box2. Returns true if the point is inside the Box2 or on the Box2 edge; otherwise false.

rectify <Box2>
Adjusts the coordinates of the box such that top < bottom and left < right.

empty <Box2>
Sets the Box2 to a special "empty" value.

isEmpty <Box2>
Returns true if the Box2 contains the special "empty" value, false otherwise.

上面是box2 的语法我没有用过。作为资料。

 box2 的实验

  up = box2 0 0 100 100
(Box2 0 0 100 100)
(Box2 0 0 100 100)
up.center 
[49,49]
99
0
99
99
0

  ---对于上面的box2 的解释 最好要自己画图。有用是基于像素的。所以基点应该是1 1 点。

在这个中, 我得出的算法就是 他的下面的point2 有就是 right bottom  加上前面的 left top 在减1 的算法。

 得出 right bottom 的值。

 

 

************************************************************************************************

vpCenter = (point2 (gw.getWinSizeX()) (gw.getWinSizeY()))/2
[615,400]
---将来的圆心点。
---总感觉是找了一个范围。
circleRegion = box2 0 0 0 0 -- initialize circleRegion to a box2 value
(Box2 -1 -1 2 2)

--以后用圆表示,这里是圆心点和圆上一点。
circleRegion.left = vpCenter.x -- the center of the circle --这里面是返回的一个数值。


615.0
--当我们定义了左。这个时候 我们看 circleRegion 的值是  (Box2 -1 -1 617 2)
--
--应为左是第一个数。后面的x 加前面的x -1 == 615

circleRegion.bottom = vpCenter.y

400.0
----我们定义了底 看看circleRegion 是(Box2 -1 0 617 401)


circleRegion.right = vpCenter.x/2 -- a point on the circle
307.5
circleRegion
(Box2 307 0 309 401)

circleRegion.top = vpCenter.y --左和顶是第一组坐标,也就是说是 圆形选择的原点。
400.0
circleRegion (Box2 307 400 309 1)

---上面是后一组坐标。 bottom 是后一组的y值,由上面两个数确定半径。
--就是这样的。以试图的 最大 xy 各取中心点为原点, 以平行于x 并且过原点的 。x取值原来一般。
这样就有了 原点还有边

--说白了我们的鼠标为什么能选择试中的物体,其实就是因为这个函数的存在。他可以方 也可以圆形的选择。
 oop =for obj in (circlePickNode circleRegion crossing:false) collect obj

#($Sphere:Sphere01 @ [45.523499,34.512344,0.000000], $Sphere:Sphere02 @ [12.353422,22.442947,0.000000], $Sphere:Sphere03 @ [-11.847525,18.393448,0.000000], $Sphere:Sphere04 @ [-36.874302,25.021164,0.000000], $Sphere:Sphere05 @ [-110.771210,314.260803,0.000000], $Sphere:Sphere06 @ [-67.260963,424.976379,0.000000])

---其实还是有点不明白。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

原文地址:https://www.cnblogs.com/gaitian00/p/2020626.html