[name]

يمثل مربعًا محدودًا بمحاور (AABB) في الفضاء ثنائي الأبعاد.

المنشئ (Constructor)

[name]( [param:Vector2 min], [param:Vector2 max] )

[page:Vector2 min] - (اختياري) [page:Vector2] يمثل الحد السفلي (x، y) للمربع. الافتراضي هو (+ Infinity، + Infinity).
[page:Vector2 max] - (اختياري) [page:Vector2] يمثل الحد العلوي (x، y) للمربع. الافتراضي هو (- Infinity، - Infinity).

ينشئ [name] محدودًا بواسطة min و max.

الخصائص (Properties)

[property:Vector2 min]

[page:Vector2] يمثل الحد السفلي (x، y) للمربع.
الافتراضي هو (+ Infinity، + Infinity).

[property:Vector2 max]

[page:Vector2] يمثل الحد العلوي (x، y) للمربع.
الافتراضي هو (- Infinity، - Infinity).

الطرق (Methods)

[method:Vector2 clampPoint]( [param:Vector2 point], [param:Vector2 target] )

[page:Vector2 point] - [page:Vector2] للتثبيت.
[page:Vector2 target] — سيتم نسخ النتيجة في هذا Vector2.

[link:https://en.wikipedia.org/wiki/Clamping_(graphics) يثبت] [page:Vector2 point] داخل حدود هذا المربع.

[method:Box2 clone]()

يعود بـ [page:Box2] جديد مع نفس [page:.min min] و [page:.max max] كهذا المربع.

[method:Boolean containsBox]( [param:Box2 box] )

[page:Box2 box] - [page:Box2 Box2] للاختبار للتضمين.

يعود بـ true إذا كان هذا المربع يشمل كامل [page:Box2 box]. إذا كان هذا و [page:Box2 box] متطابقان،
فإن هذه الوظيفة تعود أيضًا بـ true.

[method:Boolean containsPoint]( [param:Vector2 point] )

[page:Vector2 point] - [page:Vector2] للاختبار للتضمين.

يعود بـ true إذا كانت [page:Vector2 point] المحددة تقع داخل أو على حدود هذا المربع.

[method:this copy]( [param:Box2 box] )

ينسخ [page:.min min] و [page:.max max] من [page:Box2 box] إلى هذا المربع.

[method:Float distanceToPoint]( [param:Vector2 point] )

[page:Vector2 point] - [page:Vector2] لقياس المسافة إليها.

يعود بالمسافة من أي حافة لهذا المربع إلى النقطة المحددة. إذا كانت [page:Vector2 point] داخل هذا المربع، فستكون المسافة 0.

[method:Boolean equals]( [param:Box2 box] )

[page:Box2 box] - مربع للمقارنة مع هذا المربع.

يعود بـ true إذا كان هذا المربع و [page:Box2 box] يشتركان في نفس الحدود السفلى والعليا.

[method:this expandByPoint]( [param:Vector2 point] )

[page:Vector2 point] - [page:Vector2] التي يجب تضمينها في المربع.

يوسع حدود هذا المربع لتضمين [page:Vector2 point].

[method:this expandByScalar]( [param:Float scalar] )

[page:Float scalar] - المسافة التي يتم توسيع المربع بها.

يوسع كل بُعد من أبعاد المربع بواسطة [page:Float scalar]. إذا كانت سالبة، فستتقلص أبعاد المربع.

[method:this expandByVector]( [param:Vector2 vector] )

[page:Vector2 vector] - [page:Vector2] لتوسيع المربع بها.

يوسع هذا المربع بشكل متساوٍ بواسطة [page:Vector2 vector]. سيتم توسيع عرض هذا المربع بمكون x من [page:Vector2 vector] في كلا الاتجاهين. ستتم توسيع ارتفاع هذا المربع بمكون y من [page:Vector2 vector] في كلا الاتجاهين.

[method:Vector2 getCenter] ([param:Vector2 target])

[page:Vector2 target] — سيتم نسخ النتيجة في هذا Vector2.

يعود نقطة المركز للصندوق كـ [page:Vector2].

[method:Vector2 getParameter] ([param:Vector2 point], [param:Vector2 target])

[page:Vector2 point] - [page:Vector2].
[page:Vector2 target] — سيتم نسخ النتيجة في هذا Vector2.

يعود نقطة كنسبة من عرض وارتفاع هذا الصندوق.

[method:Vector2 getSize] ([param:Vector2 target])

[page:Vector2 target] — سيتم نسخ النتيجة في هذا Vector2.

يعود عرض وارتفاع هذا الصندوق.

[method:this intersect] ([param:Box2 box])

[page:Box2 box] - مربع للتقاطع معه.

يعود تقاطع هذا و [page:Box2 box]، محددًا الحد الأعلى لهذا المربع إلى أقل من حدود المربعين الأعلى والحد الأدنى لهذا المربع إلى أكبر من حدود المربعين الأدنى.

[method:Boolean intersectsBox] ([param:Box2 box])

[page:Box2 box] - مربع للتحقق من التقاطع ضده.

يحدد ما إذا كان هذا المربع يتقاطع مع [page:Box2 box].

[method:Boolean isEmpty]()

يُرجَع صوابًا إذا كان هذا المربع يشمل صفر نقط داخل حدوده.
لاحظ أن المربع الذي يحتوي على حدود سفلى وعلوية متساوية لا يزال يشمل نقطة واحدة، وهي التي تشترك فيها كلا الحدود.

[method:this makeEmpty]()

يجعل هذا المربع فارغًا.

[method:this set]([param:Vector2 min], [param:Vector2 max])

[page:Vector2 min] - (مطلوب) [page:Vector2] يمثل الحد الأدنى (x، y) للمربع.
[page:Vector2 max] - (مطلوب) [page:Vector2] يمثل الحد الأعلى (x، y) للمربع.

يضع الحدود العليا والسفلى (x، y) لهذا المربع.
يرجى ملاحظة أن هذه الطريقة تنسخ فقط القيم من الكائنات المعطاة.

[method:this setFromCenterAndSize]([param:Vector2 center], [param:Vector2 size])

[page:Vector2 center] - الموضع المركزي المطلوب للمربع ([page:Vector2]).
[page:Vector2 size] - أبعاد x و y المطلوبة للمربع ([page:Vector2]).

يضع هذا المربع في مركز [page:Vector2 center] ويضع عرض وارتفاع هذا المربع إلى القيم المحددة في [page:Vector2 size].

[method:this setFromPoints]([param:Array points])

[page:Array points] - مصفوفة من [page:Vector2 Vector2s] التي ستحتوي عليها المربعات الناتجة.

يضع الحدود العليا والسفلى لهذا المربع لتشمل جميع النقاط في [page:Array points].

[method:this translate]([param:Vector2 offset])

[page:Vector2 offset] - اتجاه ومسافة التحويل.

يضيف [page:Vector2 offset] إلى كلاً من الحدود العليا والسفلى لهذا المربع، مما يؤدي بشكل فعال إلى نقل هذا المربع [page:Vector2 offset] وحدات في مسافة 2D.

[method:this union]([param:Box2 box])

[page:Box2 box] - مربع سيتم دمجه مع هذا المربع.

يجمع هذا المربع مع [page:Box2 box]، حيث يضع الحد الأقصى لهذا المربع على أكبر حدود علوية للمربعين والحد الأدنى لهذا المربع على أقل حدود سفلى للمربعين.

المصدر (Source)

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]