File: SpatialConstraint.cpp

package info (click to toggle)
siril 1.4.0~rc2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,352 kB
  • sloc: ansic: 174,082; cpp: 28,254; python: 7,891; makefile: 974; xml: 777; sh: 271
file content (45 lines) | stat: -rw-r--r-- 1,251 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//#     Filename:       SpatialConstraint.cpp
//#
//#     The SpatialConstraint, SpatialSign
//#     classes are defined here.
//#
//#     Author:         Peter Z. Kunszt based on A. Szalay's code
//#
//#     Date:           October 23, 1998
//#
//#	    SPDX-FileCopyrightText: 2000 Peter Z. Kunszt Alex S. Szalay, Aniruddha R. Thakar
//#                     The Johns Hopkins University
//#
//#     Modification History:
//#
//#     Oct 18, 2001 : Dennis C. Dinge -- Replaced ValVec with std::vector
//#

#include "SpatialConstraint.h"
#include "SpatialException.h"

// ===========================================================================
//
// Member functions for class SpatialConstraint
//
// ===========================================================================

/////////////CONSTRUCTOR//////////////////////////////////
//
SpatialConstraint::SpatialConstraint(SpatialVector a, float64 d) : a_(a), d_(d)
{
    a_.normalize();
    s_ = acos(d_);
    if (d_ <= -gEpsilon)
        sign_ = nEG;
    if (d_ >= gEpsilon)
        sign_ = pOS;
}

/////////////CONTAINS/////////////////////////////////////
// check whether a vector is inside this
//
bool SpatialConstraint::contains(const SpatialVector v)
{
    return acos(v * a_) < s_;
}