from ezdxf.math import Vec3 # Create a vector with components (1, 2, 3) v = Vec3(1, 2, 3) # Get the magnitude of the vector mag = v.magnitude # Print the magnitude print(mag) # Output: 3.7416573867739413
from ezdxf.math import Vec3 # Create two vectors v1 = Vec3(1, 2, 3) v2 = Vec3(4, 5, 6) # Add the vectors v3 = v1 + v2 # Print the result print(v3) # Output: (5.0, 7.0, 9.0)
from ezdxf.math import Vec3 # Create two vectors v1 = Vec3(1, 2, 3) v2 = Vec3(4, 5, 6) # Compute the dot product of the vectors dot_product = v1.dot(v2) # Print the result print(dot_product) # Output: 32.0This example shows how to compute the dot product of two Vec3 objects using the `dot()` method. Overall, the python ezdxf library provides a powerful set of classes and functions to work with DXF files programmatically. The Vec3 class from the ezdxf.math package is a useful class for performing various vector arithmetic and geometric calculations.