mirror of
https://github.com/nasa/trick.git
synced 2025-06-20 16:10:28 +00:00
Initial commit of everything.
This commit is contained in:
27
trick_source/trick_utils/units/src/UCFn.cpp
Normal file
27
trick_source/trick_utils/units/src/UCFn.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
PURPOSE: (Conversion Function Class for Units Conversion Package)
|
||||
|
||||
PROGRAMMERS:
|
||||
(((John M. Penn) (L-3Com/Titan) (May 2006) (v1.0)
|
||||
(Initial Release)))
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: UCFn.cpp 1839 2011-07-31 22:26:04Z penn $
|
||||
*/
|
||||
#include "UCFn.hh"
|
||||
|
||||
UCFn::UCFn(const char *in_t_name, const char *in_f_name, double C1, double C0) {
|
||||
this->C[1]=C1;
|
||||
this->C[0]=C0;
|
||||
strncpy(this->t_name, in_t_name, sizeof(this->t_name)-1);
|
||||
strncpy(this->f_name, in_f_name, sizeof(this->f_name)-1);
|
||||
};
|
||||
|
||||
double UCFn::eval( double val) {
|
||||
return ( this->C[1]*val + this->C[0] );
|
||||
};
|
||||
|
||||
std::ostream& operator<< (std::ostream& s, const UCFn *p) {
|
||||
return s << "<" << p->t_name << "> = " << p->C[1] << " * <" << p->f_name << "> + " << p->C[0];
|
||||
};
|
Reference in New Issue
Block a user