imate
C++/CUDA Reference
homographic.cpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright 2021, Siavash Ameli <sameli@berkeley.edu>
3  * SPDX-License-Identifier: BSD-3-Clause
4  * SPDX-FileType: SOURCE
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the license found in the LICENSE.txt file in the root
8  * directory of this source tree.
9  */
10 
11 
12 // =======
13 // Headers
14 // =======
15 
16 #include "./homographic.h"
17 
18 
19 // ===========
20 // Homographic
21 // ===========
22 
25 
26 Homographic::Homographic(double a_, double b_, double c_, double d_)
27 {
28  this->a = a_;
29  this->b = b_;
30  this->c = c_;
31  this->d = d_;
32 }
33 
34 
35 // ====================
36 // Homographic function (float)
37 // ====================
38 
42 
43 float Homographic::function(const float lambda_) const
44 {
45  // Casting
46  float a_ = static_cast<float>(this->a);
47  float b_ = static_cast<float>(this->b);
48  float c_ = static_cast<float>(this->c);
49  float d_ = static_cast<float>(this->d);
50 
51  return (a_ * lambda_ + b_) / (c_ * lambda_ + d_);
52 }
53 
54 
55 // ====================
56 // Homographic function (double)
57 // ====================
58 
62 
63 double Homographic::function(const double lambda_) const
64 {
65  // Casting
66  double a_ = static_cast<double>(this->a);
67  double b_ = static_cast<double>(this->b);
68  double c_ = static_cast<double>(this->c);
69  double d_ = static_cast<double>(this->d);
70 
71  return (a_ * lambda_ + b_) / (c_ * lambda_ + d_);
72 }
73 
74 
75 // ====================
76 // Homographic function (long double)
77 // ====================
78 
82 
83 long double Homographic::function(const long double lambda_) const
84 {
85  // Casting
86  long double a_ = static_cast<long double>(this->a);
87  long double b_ = static_cast<long double>(this->b);
88  long double c_ = static_cast<long double>(this->c);
89  long double d_ = static_cast<long double>(this->d);
90 
91  return (a_ * lambda_ + b_) / (c_ * lambda_ + d_);
92 }
Homographic(double a_, double b_, double c_, double d_)
Sets the default for the parameter a, b, c, and d.
Definition: homographic.cpp:26
double b
Definition: homographic.h:49
double d
Definition: homographic.h:51
double c
Definition: homographic.h:50
virtual float function(const float lambda_) const
Definition: homographic.cpp:43
double a
Definition: homographic.h:48