ParallelRoadTool/Extensions/Vector3Extensions.cs
/// <summary>
///     Given a point, a direction and a distance, we can get the coordinates for a point which is parallel to the given
///     one for the given direction.
/// </summary>
/// <param name="point"></param>
/// <param name="direction"></param>
/// <param name="horizontalDistance"></param>
/// <param name="verticalDistance"></param>
/// <param name="isClockwise"></param>
/// <returns>A <see cref="Vector3" /> with the coordinates generated by offsetting the given point.</returns>
Given a point, a direction and a distance, we can get the coordinates for a point which is parallel to the given
one for the given direction.
Given a point a direction and a distance we can get the coordinates for a point which is parallel to the given one for the given direction .
public static Vector3 Offset(this Vector3 point,
                                     Vector3 direction,
                                     float horizontalDistance,
                                     float verticalDistance,
                                     bool isClockwise = true)
        {
            var offsetPoint = point + horizontalDistance * new Vector3((isClockwise ? 1 : -1) * direction.z,
                                                                       direction.y,
                                                                       (isClockwise ? -1 : 1) * direction.x);
            offsetPoint.y = point.y + verticalDistance;
            return offsetPoint;
        }
public static Vector3 Offset ( this Vector3 point , Vector3 direction , float horizontalDistance , float verticalDistance , bool isClockwise = true ) { var offsetPoint = point + horizontalDistance * new Vector3 ( ( isClockwise ? 1 : - 1 ) * direction . z , direction . y , ( isClockwise ? - 1 : 1 ) * direction . x ) ; offsetPoint . y = point . y + verticalDistance ; return offsetPoint ; }
Given a point, a direction and a distance, we can get the coordinates for a point which is parallel to the given
one for the given direction.
Given a point a direction and a distance we can get the coordinates for a point which is parallel to the given one for the given direction .
A  with the coordinates generated by offsetting the given point.
A with the coordinates generated by offsetting the given point .
Vector3
this
direction
Vector3
None
horizontalDistance
float
None
verticalDistance
float
None
isClockwise
bool
None
point
None