A comprehensive suite of 25 3D mathematics endpoints providing vector operations, transformations, volume calculations, distance operations, and geometric primitive intersections.
The 3D mathematics tools provide high-performance mathematical operations designed for 3D graphics, robotics, CAD applications, and scientific computing. All operations are validated against reference implementations for mathematical accuracy.
- Precision: IEEE standard floating-point arithmetic with microsecond accuracy
- Speed: Vectorized operations complete in microseconds
- Validation: All operations tested against reference mathematical implementations
- Accuracy: Exact mathematical precision for all test cases
POST /3d/dot-productCalculate the dot product of two 3D vectors.
Input:
{
"vector1": {"x": 1.0, "y": 2.0, "z": 3.0},
"vector2": {"x": 4.0, "y": 5.0, "z": 6.0}
}Output:
{
"dot_product": 32.0,
"vector1": {"x": 1.0, "y": 2.0, "z": 3.0},
"vector2": {"x": 4.0, "y": 5.0, "z": 6.0}
}POST /3d/cross-productCalculate the cross product of two 3D vectors.
POST /3d/vector-magnitudeCalculate magnitude and unit vector of a 3D vector.
POST /3d/vector-angleCalculate angle between two vectors in radians and degrees.
POST /3d/rotation-matrixCreate rotation matrix around X, Y, or Z axis.
Input:
{
"axis": "z",
"angle": 1.5707963267948966
}Output:
{
"matrix": {
"m00": 0.0, "m01": -1.0, "m02": 0.0,
"m10": 1.0, "m11": 0.0, "m12": 0.0,
"m20": 0.0, "m21": 0.0, "m22": 1.0
}
}POST /3d/rotation-arbitraryCreate rotation matrix around arbitrary axis.
POST /3d/quaternion-from-axisCreate quaternion from axis and angle representation.
POST /3d/quaternion-multiplyMultiply two quaternions for rotation composition.
POST /3d/quaternion-slerpSpherical linear interpolation between two quaternions.
POST /3d/matrix-vectorApply 3x3 transformation matrix to a vector.
POST /3d/coordinate-convertConvert between cartesian, spherical, and cylindrical coordinates.
Input:
{
"from_type": "cartesian",
"to_type": "spherical",
"coordinates": {"x": 1.0, "y": 1.0, "z": 1.0}
}POST /3d/line-intersectionFind intersection of two infinite 3D lines.
Input:
{
"line1": {
"point": {"x": 0.0, "y": 0.0, "z": 0.0},
"direction": {"x": 1.0, "y": 0.0, "z": 0.0}
},
"line2": {
"point": {"x": 1.0, "y": 0.0, "z": 0.0},
"direction": {"x": 0.0, "y": 1.0, "z": 0.0}
}
}Output:
{
"intersection_type": "Intersecting",
"intersection_point": {"x": 1.0, "y": 0.0, "z": 0.0},
"distance_between_lines": 0.0
}POST /3d/segment-intersectionFind intersection of two finite 3D line segments.
POST /3d/multi-line-intersectionFind best intersection point for multiple lines.
POST /3d/line-planeFind intersection point of line and plane.
POST /3d/plane-planeFind intersection line of two planes.
POST /3d/point-plane-distanceCalculate distance from point to plane.
POST /3d/distance/point-lineCalculate shortest distance from point to 3D line.
POST /3d/distance/point-planeCalculate perpendicular distance from point to plane.
POST /3d/distance/line-planeCalculate distance between parallel line and plane.
POST /3d/projection/vectorProject one vector onto another (scalar and vector projections).
POST /3d/projection/point-lineProject point onto closest point on line.
POST /3d/projection/point-planeProject point onto closest point on plane.
POST /3d/volume/tetrahedronCalculate volume of tetrahedron from 4 points using scalar triple product.
Input:
{
"point_a": {"x": 0.0, "y": 0.0, "z": 0.0},
"point_b": {"x": 1.0, "y": 0.0, "z": 0.0},
"point_c": {"x": 0.0, "y": 1.0, "z": 0.0},
"point_d": {"x": 0.0, "y": 0.0, "z": 1.0}
}Output:
{
"volume": 0.16666666666666666,
"calculation_method": "Scalar triple product",
"points": [
{"x": 0.0, "y": 0.0, "z": 0.0},
{"x": 1.0, "y": 0.0, "z": 0.0},
{"x": 0.0, "y": 1.0, "z": 0.0},
{"x": 0.0, "y": 0.0, "z": 1.0}
]
}POST /3d/volume/sphereCalculate volume of sphere using formula (4/3)πr³.
POST /3d/volume/cylinderCalculate volume of cylinder using formula πr²h.
POST /3d/volume/aabbCalculate volume of axis-aligned bounding box.
POST /3d/volume/pyramidCalculate volume of pyramid: (1/3) × base_area × height.
POST /3d/volume/convex-hullCalculate volume of convex hull using triangulation.
POST /3d/primitives/sphere-rayTest intersection between ray and sphere.
POST /3d/primitives/sphere-sphereTest intersection between two spheres.
POST /3d/primitives/cylinder-rayTest intersection between ray and cylinder.
POST /3d/primitives/aabb-rayTest intersection between ray and axis-aligned bounding box.
POST /3d/primitives/aabb-aabbTest intersection between two axis-aligned bounding boxes.
- Dot Product: Standard Euclidean dot product calculation
- Cross Product: Right-hand rule vector cross product
- Normalization: Unit vector calculation with magnitude preservation
- Angle Calculation: Arc-cosine of normalized dot product
- Rotation Matrices: Rodrigues' rotation formula for arbitrary axes
- Quaternions: Hamilton product and SLERP interpolation
- Coordinate Systems: Spherical and cylindrical coordinate transformations
- Matrix Operations: Standard linear algebra operations
- Line Intersection: Parametric line equations with tolerance handling
- Volume Calculations: Scalar triple product and geometric formulas
- Distance Calculations: Point-to-primitive distance algorithms
- Intersection Tests: Geometric intersection algorithms with proper edge case handling
# Rotate object around arbitrary axis
POST /3d/rotation-arbitrary
# Interpolate between orientations
POST /3d/quaternion-slerp
# Test ray-object intersection for picking
POST /3d/primitives/sphere-ray# Calculate volume of manufactured part
POST /3d/volume/convex-hull
# Find intersection of construction lines
POST /3d/line-intersection
# Calculate distances for clearance checks
POST /3d/distance/point-line# Transform coordinates between reference frames
POST /3d/coordinate-convert
# Calculate joint rotations
POST /3d/quaternion-from-axis
# Collision detection between robot parts
POST /3d/primitives/aabb-aabb# Vector analysis
POST /3d/dot-product
POST /3d/cross-product
# Geometric modeling
POST /3d/volume/tetrahedron
# Spatial analysis
POST /3d/projection/point-plane- Vector Operations: Exact mathematical precision for all test cases
- Rotations: Validated against reference quaternion implementations
- Volume Calculations: Cross-validated with analytical solutions
- Intersections: Tested with known geometric configurations
- Vector Operations: Complete in microseconds
- Matrix Operations: Optimized linear algebra routines
- Complex Calculations: Volume and intersection tests <1ms
- Batch Operations: Efficient processing of multiple geometric queries
# Basic vector operations
curl -X POST http://localhost:3000/3d/dot-product \
-H "Content-Type: application/json" \
-d '{"vector1": {"x": 1.0, "y": 2.0, "z": 3.0}, "vector2": {"x": 4.0, "y": 5.0, "z": 6.0}}'
# 3D transformations
curl -X POST http://localhost:3000/3d/rotation-matrix \
-H "Content-Type: application/json" \
-d '{"axis": "z", "angle": 1.5707963267948966}'
# Volume calculation
curl -X POST http://localhost:3000/3d/volume/tetrahedron \
-H "Content-Type: application/json" \
-d '{
"point_a": {"x": 0.0, "y": 0.0, "z": 0.0},
"point_b": {"x": 1.0, "y": 0.0, "z": 0.0},
"point_c": {"x": 0.0, "y": 1.0, "z": 0.0},
"point_d": {"x": 0.0, "y": 0.0, "z": 1.0}
}'