-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRotWire.cpp
More file actions
74 lines (67 loc) · 2.64 KB
/
RotWire.cpp
File metadata and controls
74 lines (67 loc) · 2.64 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//Copyright+LGPL
//-----------------------------------------------------------------------------------------------------------------------------------------------
// Copyright 1999-2013 Makoto Mori, Nobuyuki Oba
//-----------------------------------------------------------------------------------------------------------------------------------------------
// This file is part of MMANA.
// MMANA is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// MMANA is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public License along with MMANA. If not, see
// <http://www.gnu.org/licenses/>.
//-----------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "RotWire.h"
//---------------------------------------------------------------------
#pragma resource "*.dfm"
//TRotWireDlg *RotWireDlg;
//---------------------------------------------------------------------
__fastcall TRotWireDlg::TRotWireDlg(TComponent* AOwner)
: TForm(AOwner)
{
}
//---------------------------------------------------------------------------
int __fastcall TRotWireDlg::Execute(ANTDEF *ap)
{
EditDeg->Text = "0";
if( ShowModal() == IDOK ){
double deg;
if( Calc(deg, AnsiString(EditDeg->Text).c_str()) == FALSE ) return FALSE; //ja7ude 1.0
if( deg == 0 ) return FALSE;
WDEF *wp = ap->wdef;
int i;
for( i = 0; i < ap->wmax; i++, wp++ ){
RotWire(wp->X1, wp->Y1, wp->Z1, deg);
RotWire(wp->X2, wp->Y2, wp->Z2, deg);
}
return TRUE;
}
return FALSE;
}
void __fastcall TRotWireDlg::RotWire(double &X, double &Y, double &Z, double deg)
{
double WL;
switch(BSel->ItemIndex){
case 0: // ‚w޲
WL = sqrt(Y*Y + Z*Z);
deg += GetDeg(Y, Z);
Y = WL * cos(deg*PAI/180.0);
Z = WL * sin(deg*PAI/180.0);
break;
case 1: // ‚x޲
WL = sqrt(X*X + Z*Z);
deg += GetDeg(X, Z);
X = WL * cos(deg*PAI/180.0);
Z = WL * sin(deg*PAI/180.0);
break;
case 2: // ‚y޲
WL = sqrt(X*X + Y*Y);
deg += GetDeg(X, Y);
X = WL * cos(deg*PAI/180.0);
Y = WL * sin(deg*PAI/180.0);
break;
}
}
//---------------------------------------------------------------------