Vector3D.Scale C# (CSharp) Method

Scale() public static method

public static Scale ( Vector3D, a, Vector3D, b ) : Vector3D,
a Vector3D,
b Vector3D,
return Vector3D,
    public static Vector3D Scale(Vector3D a, Vector3D b)
    {
        return new Vector3D (a.x * b.x, a.y * b.y, a.z * b.z);
    }

Same methods

Vector3D::Scale ( Vector3D, scale ) : void

Usage Example

        // Add a normal for a polygon.
        // Assumes the points are coplanar.
        // Assumes the points are outwardly oriented.
        public static void AddPolygonNormal(this MeshGeometry3D mesh,
                                            double length, double thickness, params Point3D[] points)
        {
            // Find the "center" point.
            double x = 0, y = 0, z = 0;

            foreach (Point3D point in points)
            {
                x += point.X;
                y += point.Y;
                z += point.Z;
            }
            Point3D endpoint1 = new Point3D(
                x / points.Length,
                y / points.Length,
                z / points.Length);

            // Get the polygon's normal.
            Vector3D n = FindTriangleNormal(
                points[0], points[1], points[2]);

            // Set the length.
            n = n.Scale(length);

            // Find the segment's other end point.
            Point3D endpoint2 = endpoint1 + n;

            // Create the segment.
            AddSegment(mesh, endpoint1, endpoint2, thickness);
        }
All Usage Examples Of Vector3D::Scale