Vector4 — Aspose.3D FOSS for Java

Example

Vector4 는 이중 정밀도 4-컴포넌트 벡터입니다. 메쉬 제어점(여기서 w = 1.0 위치에 대한) 및 정상 데이터에 대해 VertexElementNormal 레이어(여기서 w 는 사용되지 않습니다).

Example: com.aspose.threed

import com.aspose.threed.*;

Vector4 point = new Vector4(1.0, 2.0, 3.0, 1.0);

Example

ExampleExample
Vector4()Example (0, 0, 0, 1)
Vector4(double x, double y, double z, double w)네 개의 구성 요소로부터 생성
Vector4(double x, double y, double z)로 생성 w = 1.0
Vector4(Vector3 v3)로부터 생성 Vector3 와 함께 w = 1.0
Vector4(Vector4 other)복사 생성자

공개 필드

Vector4 사용 공개 필드 구성 요소 접근용(게터/세터 메서드가 아님):

ExampleExampleExampleExample
xdoublev.xX 구성 요소
ydoublev.yY 구성 요소
zdoublev.zZ 구성 요소
wdoublev.wW 구성 요소(동차 좌표)

Example

Example반환 유형Example
set(double x, double y, double z, double w)void네 개의 구성 요소를 모두 설정합니다
toVector3()Vector3반환합니다 Vector3(x, y, z) 드롭하는 w 구성 요소

Example

import com.aspose.threed.*;

Mesh mesh = new Mesh();

// Add control points (w=1.0 for positions)
mesh.getControlPoints().add(new Vector4(0.0, 0.0, 0.0, 1.0));
mesh.getControlPoints().add(new Vector4(1.0, 0.0, 0.0, 1.0));
mesh.getControlPoints().add(new Vector4(0.5, 1.0, 0.0, 1.0));
mesh.createPolygon(0, 1, 2);

// Convert to Vector3
Vector4 v4 = new Vector4(1.0, 2.0, 3.0, 1.0);
Vector3 v3 = v4.toVector3();   // Vector3(1.0, 2.0, 3.0)

// Construct from Vector3
Vector3 pos = new Vector3(5.0, 0.0, 0.0);
Vector4 homogeneous = new Vector4(pos);   // w = 1.0

참고

 한국어