📄 plane.cpp
字号:
#if !defined(__plane_cpp)
#define __plane_cpp
//Difinition of plane class
#include <math.h>
#pragma hdrstop
#include "plane.h"
////Construcor and destructor
plane::plane(){
ZPlane=0.0;
};
plane::~plane(){
};
inline void plane::SetZPlane(double zp ){ ZPlane=zp; };
inline double plane::GetZPlane() {return(ZPlane);};
inline double plane::GetZ( double x, double y){
return ZPlane;
};
inline vector plane::GetPosition( double x, double y){
return ( vector( x, y, GetZ(x,y) ) );
};
inline double plane::gradX(double x, double y){
return 0.;
};
inline double plane::gradY(double x, double y){
return 0.;
};
inline double plane::gradXX(double x, double y){
return 0.;
};
inline double plane::gradYY(double x, double y){
return 0.;
};
// This is the normal vector of surface on the point(x,y).
// This is toward the inside of plane.
// This.length is 1.
vector plane::NormalVector ( double x, double y){
return ( vector( -gradX(x,y), -gradY(x,y), 1).normalize() ); //OK 980520
};
vector plane::NormalVector ( vector position){
return ( NormalVector( position.getX(), position.getY() ) );
};
////GradientVector////////////////////////////////////////////
// This is one of tangential vactors on the tangential plane.
// This is toward direction which has the largest gradient.
// This length is 1.
vector plane::GradientVector(double x, double y){
double gx = gradX( x,y);
double gy = gradY( x,y);
return ( vector( gx, gy, gx*gx+gy*gy ).normalize() );
};
vector plane::GradientVector( vector position){
return( GradientVector( position.getX(), position.getY() ) );
};
////NoGradientVector///////////////////////////////////////////
// This is one of tangential vactors on the tangential plane.
// This is toward direction which has no gradient.
//// This length will be 1,
//// and this Z-coordinate will be Zero.
vector plane::NoGradientVector(double x,double y){
return( NormalVector(x,y)%GradientVector(x,y) );
};
vector plane::NoGradientVector(vector position){
return( NormalVector(position)%GradientVector(position) );
};
int plane::WriteFaceName(ofstream& fout){
fout << "(Face name is : plane);" << endl;
return(1);
};
int plane::WriteParameters(ofstream& fout){
fout << "(,which ZPlane[mm] is :" << ZPlane <<");" << endl;
return(1);
};
void plane::SetParameter(TStringList *str)
{
for (int i=0; i<str->Count; i++){
AnsiString temp;
temp = "ZPlane";
if (str->Names[i]==temp){
ZPlane = str->Values[str->Names[i]].ToDouble();
};
};
face::SetFaceParameter(str);
};
void plane::GetParameter(TStringList *str)
{
str->Add(AnsiString("---plane parameter(s)---"));
str->Add(AnsiString("FaceType=plane"));
str->Add(AnsiString("ZPlane=")+ ZPlane);
face::GetFaceParameter(str);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -