---
name: "Transpose"
section: "3"
platform: "linux"
package: "libvolpack1-dev"
version: "1.0b3-10"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Transpose"
---

# Transpose(3)

transpose a volume

## NAME

vpTranspose - transpose a volume

## SYNOPSIS

\#include \<volpack.h\>

vpResult

**vpTranspose(***vpc, axis***)**

-

  vpContext \**vpc;*

-

  int *axis;*

## ARGUMENTS

- *vpc*

  VolPack context from **vpCreateContext.**

- *axis*

  Axis which should have the smallest stride after transposing (VP\_X\_AXIS, VP\_Y\_AXIS or VP\_Z\_AXIS).

## DESCRIPTION

**vpTranspose** is used to transpose the 3D voxel array to optimize the memory stride for a particular principal viewing axis.  The intended way to use this function is to set the viewing transformation, call **vpGeti** with the VP\_VIEW\_AXIS argument to find the corresponding viewing axis, and then call **vpTranspose** with that axis.  Transposing the data changes the arrangement of the data stored in the 3D voxel array.  The voxel stride state variables are updated to reflect this change, so the viewing transformation does not need to be changed after transposing.  If the volume is already transposed for the requested axis then it returns immediately without modifying the voxel array.

This function is useful only for rendering large 3D voxel arrays.  This function has no affect on the preclassified volume data.

## STATE VARIABLES

Relevant variables may be retrieved with the following state variable codes (see vpGeti(3)): VP\_VIEW\_AXIS, VP\_VOXEL\_XSTRIDE, VP\_VOXEL\_YSTRIDE, VP\_VOXEL\_ZSTRIDE.

## ERRORS

The normal return value is VP\_OK.  The following error return values are possible:

- VPERROR\_BAD\_OPTION

  The *axis* argument is invalid.

- VPERROR\_BAD\_VOLUME

  The 3D voxel array is missing or invalid.

- VPERROR\_BAD\_VOXEL

  The voxel fields are incorrectly specified.

## SEE ALSO

[VolPack(3)](/VolPack/3.md), vpCreateContext(3)
