BRL-CAD
px_event.cpp
Go to the documentation of this file.
1 /* P X _ E V E N T . C P P
2  * BRL-CAD
3  *
4  * Copyright (c) 2013-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file px_event.cpp
21  *
22  * Implementation of ON_PX_EVENT.
23  *
24  */
25 
26 #include "common.h"
27 #include "brep.h"
28 
29 ON_PX_EVENT::ON_PX_EVENT()
30 {
31  memset(this,0,sizeof(*this));
32 }
33 
34 int
35 ON_PX_EVENT::Compare(const ON_PX_EVENT* a, const ON_PX_EVENT* b)
36 {
37  if (!a) {
38  return b ? 1 : 0;
39  }
40 
41  if (!b)
42  return -1;
43 
44  return a->m_Mid < b->m_Mid;
45 }
46 
47 bool
48 ON_PX_EVENT::IsValid(ON_TextLog*,
49  double,
50  const class ON_3dPoint*,
51  const class ON_3dPoint*,
52  const class ON_Curve*,
53  const class ON_Interval*,
54  const class ON_Surface*,
55  const class ON_Interval*,
56  const class ON_Interval*) const
57 {
58  // Implement later.
59  return true;
60 }
61 
62 void
63 ON_PX_EVENT::Dump(ON_TextLog& text_log) const
64 {
65  text_log.Print("m_type: ");
66  switch (m_type) {
67  case ON_PX_EVENT::no_px_event:
68  text_log.Print("no_px_event");
69  break;
70  case ON_PX_EVENT::ppx_point:
71  text_log.Print("ppx_point");
72  break;
73  case ON_PX_EVENT::pcx_point:
74  text_log.Print("pcx_point");
75  break;
76  case ON_PX_EVENT::psx_point:
77  text_log.Print("psx_point");
78  break;
79  default:
80  text_log.Print("illegal value");
81  break;
82  }
83  text_log.Print("\n");
84  text_log.PushIndent();
85 
86  text_log.Print("Intersection Point: \n");
87  text_log.PushIndent();
88  text_log.Print(m_Mid);
89  text_log.Print("\n");
90  text_log.PopIndent();
91  text_log.Print("With uncertainty radius: \n");
92  text_log.PushIndent();
93  text_log.Print(m_radius);
94  text_log.Print("\n");
95  text_log.PopIndent();
96  text_log.PopIndent();
97 
98  text_log.Print("pointA = \n");
99  text_log.PushIndent();
100  text_log.Print(m_A);
101  text_log.Print("\n");
102  text_log.PopIndent();
103 
104  switch (m_type) {
105  case ON_PX_EVENT::ppx_point:
106  text_log.Print("pointB = \n");
107  break;
108 
109  case ON_PX_EVENT::pcx_point:
110  text_log.Print("curveB(");
111  text_log.Print(m_b[0]);
112  text_log.Print(") = \n");
113  break;
114 
115  case ON_PX_EVENT::psx_point:
116  text_log.Print("surfaceB");
117  text_log.Print(m_b);
118  text_log.Print(" = \n");
119  break;
120 
121  case ON_PX_EVENT::no_px_event:
122  break;
123  }
124 
125  text_log.PushIndent();
126  text_log.Print(m_B);
127  text_log.Print("\n");
128  text_log.PopIndent();
129 
130  text_log.PopIndent();
131 }
132 
133 // Local Variables:
134 // tab-width: 8
135 // mode: C++
136 // c-basic-offset: 4
137 // indent-tabs-mode: t
138 // c-file-style: "stroustrup"
139 // End:
140 // ex: shiftwidth=4 tabstop=8
Header file for the BRL-CAD common definitions.
void * memset(void *s, int c, size_t n)