This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
homogeneous.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_BASE_GF_HOMOGENEOUS_H
8#define PXR_BASE_GF_HOMOGENEOUS_H
9
13
14#include "pxr/pxr.h"
15#include "pxr/base/gf/vec3d.h"
16#include "pxr/base/gf/vec3f.h"
17#include "pxr/base/gf/vec4d.h"
18#include "pxr/base/gf/vec4f.h"
19#include "pxr/base/gf/api.h"
20
21PXR_NAMESPACE_OPEN_SCOPE
22
26GF_API
28
33GF_API
35
36GF_API
38
43GF_API
45
48inline GfVec3f GfProject(const GfVec4f &v) {
49 float inv = (v[3] != 0.0f) ? 1.0f/v[3] : 1.0f;
50 return GfVec3f(inv * v[0], inv * v[1], inv * v[2]);
51}
52
55inline GfVec3d GfProject(const GfVec4d &v) {
56 double inv = (v[3] != 0.0) ? 1.0/v[3] : 1.0;
57 return GfVec3d(inv * v[0], inv * v[1], inv * v[2]);
58}
59
60PXR_NAMESPACE_CLOSE_SCOPE
61
62#endif /* PXR_BASE_GF_HOMOGENEOUS_H */
Basic type for a vector of 3 double components.
Definition: vec3d.h:46
Basic type for a vector of 3 float components.
Definition: vec3f.h:46
Basic type for a vector of 4 double components.
Definition: vec4d.h:46
Basic type for a vector of 4 float components.
Definition: vec4f.h:46
GF_API GfVec4f GfGetHomogenized(const GfVec4f &v)
Returns a vector which is v homogenized.
GF_API GfVec4f GfHomogeneousCross(const GfVec4f &a, const GfVec4f &b)
Homogenizes a and b and then performs the cross product on the first three elements of each.
GfVec3f GfProject(const GfVec4f &v)
Projects homogeneous v into Euclidean space and returns the result as a Vec3f.
Definition: homogeneous.h:48