Class BoundingBox

Class BoundingBox

패키지: @aspose/3d (v24.12.0)

BoundingBox 3D 공간에서 axis-aligned bounding box (AABB)를 나타냅니다. 이것은 minimum corner와 maximum corner를 단순 객체로 x, y, z 필드. 새로 생성된 BoundingBox() 인수가 없는 경우는 “null” 상태이며 — minimum 반환합니다 +Infinity 그리고 maximum 반환합니다 -Infinity — 그리고 포인트가 via를 통해 추가될 때 올바르게 확장됩니다 merge(). BoundingBox 는(은) 다음에서 내보내집니다 @aspose/3d/utilities 하위 경로에서.

export class BoundingBox
import { BoundingBox } from '@aspose/3d/utilities';

ColladaSaveOptions

점 집합에 대한 경계 상자를 계산합니다.

import { BoundingBox, Vector3 } from '@aspose/3d/utilities';

const points = [
  new Vector3(-1, 0, -1),
  new Vector3(1, 2, 1),
  new Vector3(0, -0.5, 0),
];

const bbox = new BoundingBox();
for (const p of points) {
  bbox.merge(p);
}

console.log(`Min: (${bbox.minimum.x}, ${bbox.minimum.y}, ${bbox.minimum.z})`);
// Min: (-1, -0.5, -1)
console.log(`Max: (${bbox.maximum.x}, ${bbox.maximum.y}, ${bbox.maximum.z})`);
// Max: (1, 2, 1)

const c = bbox.center;
console.log(`Center: (${c.x}, ${c.y.toFixed(3)}, ${c.z})`);
// Center: (0, 0.750, 0)

ColladaSaveOptions

ColladaSaveOptionsColladaSaveOptions
new BoundingBox()null 경계 상자를 생성합니다. 다음이 호출될 때 확장됩니다 merge() 가 호출됩니다.
new BoundingBox(minimum, maximum)두 개를 사용하여 상자를 생성합니다. {x, y, z} 코너 객체들.
new BoundingBox(minX, minY, minZ, maxX, maxY, maxZ)여섯 개의 스칼라 구성 요소로부터 상자를 생성합니다.

@aspose/3d의 모든 포맷별 로드 및 저장 옵션 클래스에 대한 레퍼런스이며, glTF, OBJ, STL, FBX를 포함합니다.

ColladaSaveOptionsColladaSaveOptionsColladaSaveOptions
BoundingBox.nullBoundingBoxnull 경계 상자 (범위 없음, 초기화되지 않음).
BoundingBox.infiniteBoundingBox전체 숫자 범위를 아우르는 박스, 시작은 -Infinity 까지 +Infinity.

ColladaSaveOptions

중요한 명명 규칙: BoundingBox 사용 minimummaximum — 사용 안 함 minmax.

ColladaSaveOptionsColladaSaveOptionsColladaSaveOptions
minimum{x: number, y: number, z: number} (읽기 전용)가장 작은 x, y, z 값을 갖는 코너. 반환값은 +Infinity 박스가 null일 때 각 축에 대해.
maximum{x: number, y: number, z: number} (읽기 전용)가장 큰 x, y, z 값을 갖는 코너. 반환값은 -Infinity 박스가 null일 때 각 축에 대해.
center{x: number, y: number, z: number} (읽기 전용)기하학적 중심, 계산식은 (minimum + maximum) / 2. 반환값은 (0, 0, 0) null일 때.
size{x: number, y: number, z: number} (읽기 전용)상자의 치수: maximum - minimum 축당.
extentBoundingBoxExtent (읽기 전용)각 축에 대한 반길이. 각 필드는 Math.abs(size / 2).

ColladaSaveOptions

merge(point)

점이 포함되도록 경계 상자를 확장합니다. 다음을 허용합니다: {x, y, z} 객체, a Vector3, 3개의 숫자로 이루어진 배열, 또는 세 개의 별도 (x, y, z) 인수.

merge(point: Vector3 | {x: number, y: number, z: number}): void
merge(x: number, y: number, z: number): void

ColladaSaveOptions

import { BoundingBox, Vector3 } from '@aspose/3d/utilities';

const bb = new BoundingBox();
bb.merge(new Vector3(2, 3, 4));
bb.merge(-1, 0, 0);
console.log(`Min X: ${bb.minimum.x}`); // Min X: -1
console.log(`Max Y: ${bb.maximum.y}`); // Max Y: 3

contains(arg)

ColladaSaveOptions true 주어진 점이나 경계 상자가 이 상자 안에 완전히 포함되는지 확인합니다. 다음을 허용합니다: {x, y, z} 점 객체, a Vector3, 또는 다른 BoundingBox.

contains(arg: Vector3 | {x: number, y: number, z: number} | BoundingBox): boolean

ColladaSaveOptions

import { BoundingBox, Vector3 } from '@aspose/3d/utilities';

const bb = new BoundingBox(-1, -1, -1, 1, 1, 1);
console.log(bb.contains(new Vector3(0, 0, 0)));  // true
console.log(bb.contains(new Vector3(2, 0, 0)));  // false

overlapsWith(box)

ColladaSaveOptions true 이 경계 상자가 다른 상자와 겹치는 경우 BoundingBox (모서리가 맞닿아도 겹치는 것으로 간주합니다).

overlapsWith(box: BoundingBox): boolean

scale()

모든 코너의 절대 좌표값 중 최대값을 반환하며, 이는 경계 상자의 주요 스케일을 나타냅니다. 반환값은 0 상자가 null인 경우.

scale(): number

BoundingBoxExtent

BoundingBoxExtent 는 다음에 의해 반환되는 보조 클래스입니다 BoundingBox.extent. 각 축에 대한 반길이를 저장합니다.

ColladaSaveOptionsColladaSaveOptionsColladaSaveOptions
extentXnumberX축을 따라 절반 너비.
extentYnumberY축을 따라 절반 높이.
extentZnumberZ축을 따라 절반 깊이.
 한국어