OWL
Loading...
Searching...
No Matches
rotate.h
1// ======================================================================== //
2// Copyright 2018-2019 Ingo Wald //
3// //
4// Licensed under the Apache License, Version 2.0 (the "License"); //
5// you may not use this file except in compliance with the License. //
6// You may obtain a copy of the License at //
7// //
8// http://www.apache.org/licenses/LICENSE-2.0 //
9// //
10// Unless required by applicable law or agreed to in writing, software //
11// distributed under the License is distributed on an "AS IS" BASIS, //
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
13// See the License for the specific language governing permissions and //
14// limitations under the License. //
15// ======================================================================== //
16
17#pragma once
18
19namespace owl {
20 namespace common {
21
27 inline __both__ float rotate(const float a, const float b)
28 {
29 float sum = a+b;
30 return ((sum-1.f)<0.f)?(sum):(sum-1.f);
31 }
32
38 inline __both__ vec2f rotate(const vec2f a, const vec2f b)
39 { return vec2f(rotate(a.x,b.x),rotate(a.y,b.y)); }
40
41 } // ::owl::common
42} // ::owl