Vector3 — Aspose.3D FOSS for Java

Enumerations

Vector3 एक डबल-प्रिसीजन 3-घटक वेक्टर है जिसमें x, y, और z घटक। यह Aspose.3D में स्थितियों, दिशाओं, सामान्यों, और स्केल मानों के लिए व्यापक रूप से उपयोग किया जाता है। सभी अंकगणितीय संचालन नए Vector3 इंस्टेंस लौटाते हैं; मूल में कोई परिवर्तन नहीं किया जाता।.

import com.aspose.threed.*;

// Construct from components
Vector3 v = new Vector3(1.0, 2.0, 3.0);

// Copy constructor
Vector3 v2 = new Vector3(v);

// Default (zero vector)
Vector3 zero = new Vector3();

Enumerations

EnumerationsEnumerations
Vector3()शून्य वेक्टर बनाता है (0, 0, 0)
Vector3(double x, double y, double z)तीन घटकों से बनाता है
Vector3(Vector3 other)कॉपी कंस्ट्रक्टर

सार्वजनिक फ़ील्ड्स

Vector3 का उपयोग करता है सार्वजनिक फ़ील्ड्स घटक पहुँच के लिए (गेटर/सेटर मेथड्स नहीं):

EnumerationsEnumerationsEnumerationsEnumerations
xdoublev.xX घटक
ydoublev.yY घटक
zdoublev.zZ घटक

गणना किए गए गुण

EnumerationsEnumerationsEnumerationsEnumerations
lengthdoublegetLength()यूक्लिडियन लंबाई (sqrt(x^2+y^2+z^2)), केवल-पढ़ने योग्य
length2doublegetLength2()वर्ग लंबाई, केवल-पढ़ने योग्य; इससे सस्ता है getLength() जब केवल तुलना की आवश्यकता हो

स्थैतिक फ़ील्ड्स

EnumerationsEnumerationsEnumerations
ZEROVector3Vector3(0, 0, 0)
ONEVector3Vector3(1, 1, 1)
UNIT_XVector3Vector3(1, 0, 0)
UNIT_YVector3Vector3(0, 1, 0)
UNIT_ZVector3Vector3(0, 0, 1)

Enumerations

Enumerationsरिटर्न टाइपEnumerations
set(double x, double y, double z)voidतीनों घटकों को स्थान पर सेट करता है
dot(Vector3 rhs)doubleदूसरे के साथ डॉट प्रोडक्ट Vector3
cross(Vector3 rhs)Vector3क्रॉस प्रोडक्ट – दोनों ऑपरेण्ड्स के लम्बवत एक वेक्टर लौटाता है
normalize()Vector3एक इकाई-लंबाई की कॉपी लौटाता है; यदि लंबाई शून्य हो तो शून्य वेक्टर लौटाता है
angleBetween(Vector3 dir)doubleइस वेक्टर और के बीच रेडियन में कोण dir
angleBetween(Vector3 dir, Vector3 up)doubleपरिभाषित तल पर प्रोजेक्ट किया गया रेडियन में साइन किया हुआ कोण up
sin()Vector3घटक-वार sine
cos()Vector3घटक-वार cosine
compareTo(Vector3 other)intशाब्दिक तुलना: -1, 0, या 1 लौटाती है
Vector3.parse(String s)Vector3स्थैतिक। Parses "x y z" string प्रतिनिधित्व

Enumerations

import com.aspose.threed.*;
import com.aspose.threed.Scene;

// Basic arithmetic
Vector3 a = new Vector3(1.0, 0.0, 0.0);
Vector3 b = new Vector3(0.0, 1.0, 0.0);

// Dot and cross products
double dot = a.dot(b);           // 0.0
Vector3 perp = a.cross(b);      // Vector3(0, 0, 1)

// Normalize
Vector3 direction = new Vector3(3.0, 4.0, 0.0);
Vector3 unit = direction.normalize();   // Vector3(0.6, 0.8, 0.0)
System.out.println(unit.getLength());    // 1.0

// Angle between vectors
double angle = a.angleBetween(b);
System.out.println(Math.toDegrees(angle));   // 90.0

// Use with a scene node transform
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("box");
node.getTransform().setTranslation(new Vector3(10.0, 0.0, 0.0));

संबंधित देखें

 हिन्दी