資源簡介
Unwrap by changing deltas between values to 2*pi complement. Unwrap radian phase phase by changing absolute jumps greater than discont to their 2*pi complement along the given axis.
代碼片段和文件信息
//
//??unwrap.cpp
//
//??Copyright???2017?Z.?Nan.?All?rights?reserved.
//
#?include?
#?include?
#?include?
#?define?PI?3.14159265358979323846
using?namespace?std;
double?mod(double?a?double?b)?{
????/*
?????Return?remainder?of?division.
?????
?????:param?a:?dividend
?????:param?b:?divisor
?????:return?remains:?remainder?of?the?quotient?floor_divide(a?b)
?????*/
????
????int?quotients;
????double?remains;
????
????if?(a?>=?0?&&?b?>?0)?{
????????if?(a?????????????remains?=?a;
????????}
????????else?if?(a?==?b)?{
????????????remains?=?0;
????????}
????????else?{
????????????quotients?=?(int)?(a/b);
????????????remains?=?a?-?b?*?quotients;
????????}
????}
????else?if?(a?<=?0?&&?b?0)?{
????????remains?=?mod(-a?-b);
????????remains?=?-remains;
????}
????else?if?(a?<=?0?&&?b?>?0)?{
????????remains?=?mod(-a?b);
????????remains?=?b?-?remains;
????}
????else?if?(a?>=?0?&&?b?0)?{
????????remains?=?mod(-a?-b);
????????remains?=?-remains;
????}
????else?{
????????cout?<“Input?Error!“?<????????exit(0);
????}
????
????return?remains;
}
void?unwrap(vector?&?phase?vector?&?unwrapped_phase)?{
????/*
?????Unwrap?by?changing?deltas?between?values?to?2?*?pi?complement.
?????
?????Unwrap?radian?phase?phase?by?changing?absolute?jumps?greater?than?discont?to?their?2?*?pi?complement?along?the?given?axis.
?????
?????:param?phase:?input?array
?????:return?unwrap
- 上一篇:二維繪圖系統(tǒng)
- 下一篇:Effective C++中文版 超清pdf
評論
共有 條評論