7fd59977 |
1 | // File: Xw_points.cxx |
2 | // Created: Wed Feb 20 17:50:06 2002 |
3 | // Author: Sergey ALTUKHOV |
4 | // <sav@vovox> |
5 | |
6 | #include <Standard_Integer.hxx> |
7 | #include <Standard_ErrorHandler.hxx> |
8 | #include <Standard_Failure.hxx> |
9 | #include <Xw_Extension.h> |
10 | |
11 | |
12 | #ifdef XW_PROTOTYPE |
13 | int PXPOINT( double x, double ratio ) |
14 | #else |
15 | int PXPOINT( x, ratio ) |
16 | double x, ratio; |
17 | #endif /*XW_PROTOTYPE*/ |
18 | { |
19 | int result = 0; |
20 | try { |
21 | OCC_CATCH_SIGNALS |
22 | result = (int) ( x / ratio ); |
23 | } |
24 | catch (Standard_Failure) { |
25 | result = ROUND( x / ratio ); |
26 | } |
27 | return result; |
28 | } |
29 | |
30 | |
31 | #ifdef XW_PROTOTYPE |
32 | int PYPOINT( double y, double height, double ratio ) |
33 | #else |
34 | int PYPOINT( y, height, ratio ) |
35 | double y, height, ratio; |
36 | #endif /*XW_PROTOTYPE*/ |
37 | { |
38 | int result = 0; |
39 | try { |
40 | OCC_CATCH_SIGNALS |
41 | result = (int)( height - ( y / ratio ) ); |
42 | } |
43 | catch (Standard_Failure) { |
44 | result = ROUND( height - ( y / ratio ) ); |
45 | } |
46 | return result; |
47 | } |
48 | |
49 | |
50 | #ifdef XW_PROTOTYPE |
51 | int PVALUE( double v, double xratio, double yratio ) |
52 | #else |
53 | int PVALUE( v, xratio, yratio ) |
54 | double v, xratio, yratio; |
55 | #endif /*XW_PROTOTYPE*/ |
56 | { |
57 | int result = 0; |
58 | try { |
59 | OCC_CATCH_SIGNALS |
60 | result = (int)( v / ( ( xratio + yratio ) / 2. ) ); |
61 | } |
62 | catch (Standard_Failure) { |
63 | result = ROUND( v / ( ( xratio + yratio ) / 2. ) ); |
64 | } |
65 | return result; |
66 | } |
67 | |