# VfCos

## Summary

Defines the relationship between the vertical cost factor and the vertical relative moving angle through a cosine function.

## Discussion

This object is used in the Distance Accumulation and Distance Allocation Spatial Analyst tools, as well as the Path Distance, Path Distance Allocation, and Path Distance Back Link Legacy Distance tools.

The vertical factor (VF) object defines the relationship between the vertical cost factor and the vertical relative moving angle (VRMA).

VF defines the vertical difficulty encountered in moving from one cell to the next.

VRMA identifies the slope angle between the FROM or processing cell and the TO cell.

The VF is determined by the cosine function of the VRMA.

## Syntax

`VfCos ({lowCutAngle}, highCutAngle, {cosPower})`
 Parameter Explanation Data Type lowCutAngle The VRMA degree defining the lower threshold, below which (less than) the VFs are set to infinity.(The default value is -90.0) Double highCutAngle The VRMA degree defining the upper threshold, beyond which (larger than) the VFs are set to infinity.(The default value is 90.0) Double cosPower The power to which the values in the cosine VRMA function will be raised. The VF is determined by:`` VF = cos(VRMA)power`` (The default value is 1.0) Double

## Properties

 Property Explanation Data Type lowCutAngle(Read and Write) The VRMA degree defining the lower threshold, below which (less than) the VFs are set to infinity. Double highCutAngle(Read and Write) The VRMA degree defining the upper threshold, beyond which (larger than) the VFs are set to infinity. Double cosPower(Read and Write) The power to which the values in the cosine VRMA function will be raised. The VF is determined by:`` VF = cos(VRMA)power`` Double

## Code sample

VfCos example 1 (Python window)

Demonstrates how to create a VfCos class and use it in the DistanceAccumulation tool within the Python window.

``````import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
myVerticalFactor = VfCos(-15, 15, 1.5)
outDistAccum = DistanceAccumulation("Source.shp", "", "elev.tif",
"cost.tif", "elev.tif",
myVerticalFactor)
outDistAccum.save("C:/sapyexamples/output/distAccumVfC.tif")``````
VfCos example 2 (stand-alone script)

Performs a DistanceAccumulation analysis using the VfCos class.

``````# Name: VfCos_Ex_02.py
# Description: Uses the VfCos object to run the
#              DistanceAccumulation tool
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inSourceData = "source.shp"
inCostRaster = "costraster.tif"
inElevation = "elev.tif"

# Create the VfCos Object
lowCutAngle = -15
highCutAngle = 45
cosPower = 2
myVerticalFactor = VfCos(lowCutAngle, highCutAngle, cosPower)

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute PathDistance
outDistAccum = DistanceAccumulation(inSourceData, "", inElevation,
inCostRaster, inElevation,
myVerticalFactor)

# Save the output
outDistAccum.save("C:/sapyexamples/output/distaccumvfC2.tif")``````