This example demonstrates fundamental geometric operations using VSL's Geometry Module (gm).
The example showcases:
- Creating and working with 3D points
- Distance calculations between points
- Working with segments and vectors
- Vector mathematics (dot product, norms, angles)
- Vector arithmetic operations
- Point displacement and cloning
- Segment scaling operations
- Creating points in 3D space
- Calculating Euclidean distances between points
- Working with special geometric configurations (unit cube, 3-4-5 triangle)
- Creating line segments between points
- Converting segments to vectors
- Vector operations and calculations
- Dot product calculations
- Vector norm computation
- Angle calculations between vectors using dot product formula
- Vector addition and scaling
- Linear combinations of vectors
- Vector scaling operations
- Point displacement in 3D space
- Point cloning and manipulation
- Segment scaling (shortening/lengthening)
- Segment properties and transformations
v run main.vThe example produces detailed output showing:
- Point coordinates and relationships
- Distance calculations with mathematical verification
- Vector components and properties
- Angle measurements in degrees
- Results of various geometric operations
This example is perfect for:
- Learning basic 3D geometry concepts
- Understanding vector mathematics
- Exploring geometric relationships
- Getting familiar with VSL's geometry module API
- Euclidean distance formula: √((x₂-x₁)² + (y₂-y₁)² + (z₂-z₁)²)
- Dot product: a·b = |a||b|cos(θ)
- Vector norm: |v| = √(x² + y² + z²)
- Angle between vectors: θ = arccos((a·b)/(|a||b|))