All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
homogeneous.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef GF_HOMOGENEOUS_H
25 #define GF_HOMOGENEOUS_H
26 
30 
31 #include "pxr/pxr.h"
32 #include "pxr/base/gf/vec3d.h"
33 #include "pxr/base/gf/vec3f.h"
34 #include "pxr/base/gf/vec4d.h"
35 #include "pxr/base/gf/vec4f.h"
36 #include "pxr/base/gf/api.h"
37 
38 PXR_NAMESPACE_OPEN_SCOPE
39 
43 GF_API
45 
50 GF_API
51 GfVec4f GfHomogeneousCross(const GfVec4f &a, const GfVec4f &b);
52 
53 GF_API
55 
60 GF_API
61 GfVec4d GfHomogeneousCross(const GfVec4d &a, const GfVec4d &b);
62 
65 inline GfVec3f GfProject(const GfVec4f &v) {
66  float inv = (v[3] != 0.0f) ? 1.0f/v[3] : 1.0f;
67  return GfVec3f(inv * v[0], inv * v[1], inv * v[2]);
68 }
69 
72 inline GfVec3d GfProject(const GfVec4d &v) {
73  double inv = (v[3] != 0.0) ? 1.0/v[3] : 1.0;
74  return GfVec3d(inv * v[0], inv * v[1], inv * v[2]);
75 }
76 
77 PXR_NAMESPACE_CLOSE_SCOPE
78 
79 #endif /* GF_HOMOGENEOUS_H */
GfVec3f GfProject(const GfVec4f &v)
Projects homogeneous v into Euclidean space and returns the result as a Vec3f.
Definition: homogeneous.h:65
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...
Basic type for a vector of 3 float components.
Definition: vec3f.h:63
Basic type for a vector of 4 double components.
Definition: vec4d.h:63
Basic type for a vector of 4 float components.
Definition: vec4f.h:63
GF_API GfVec4f GfGetHomogenized(const GfVec4f &v)
Returns a vector which is v homogenized.
Basic type for a vector of 3 double components.
Definition: vec3d.h:63