1700 lines
58 KiB
C++
1700 lines
58 KiB
C++
#include "CurveInterpreter.h"
|
||
#include "Constants.h"
|
||
#include "DataManager.h"
|
||
#include <algorithm>
|
||
#include <stdexcept>
|
||
#include <cmath> // For mathematical operations like std::abs and std::sqrt
|
||
#include <limits> // For std::numeric_limits
|
||
#include <regex>
|
||
#include "DataManagerGlobal.h"
|
||
#include "Geometry_M.h"
|
||
#include "Common/tangible_string_helper.h"
|
||
const double Degree = 0.0174533; // 角度转弧度常数
|
||
|
||
CurveInterpreter::CurveInterpreter() : tempCmd(false) {}
|
||
|
||
// std::vector<std::shared_ptr<IModel>> CurveInterpreter::GenerateTempObj(std::vector<std::string> commandLines) {
|
||
// tempObj.clear();
|
||
// tempCmd = true;
|
||
// ExecuteCommand(commandLines);
|
||
// tempCmd = false;
|
||
// return tempObj;
|
||
// }
|
||
|
||
void CurveInterpreter::ExecuteCommand(std::vector<std::string> &commandLines, Curve_M &curve,std::vector<Point3D_M>& pointList)
|
||
{
|
||
pList.clear();
|
||
cmd.clear();
|
||
std::string firstWord = StringHelper::FirstWord(commandLines[0]);
|
||
std::string firstWordUpper = StringHelper::toUpper(firstWord);
|
||
|
||
if (firstWordUpper == "CURVE")
|
||
{
|
||
curve.m_Type = 0;
|
||
}
|
||
else if (firstWordUpper == "ELLIPSE")
|
||
{
|
||
curve.m_Type = 2;
|
||
}
|
||
else if (firstWordUpper == "PARABOLA")
|
||
{
|
||
curve.m_Type = 3;
|
||
}
|
||
else
|
||
{
|
||
throw std::runtime_error("Unsupported curve type.");
|
||
}
|
||
|
||
// 名称行
|
||
std::string name;
|
||
std::string tempcmd = commandLines[0];
|
||
|
||
if (!ParseName(curve, name, tempcmd))
|
||
{
|
||
throw std::runtime_error("命令执行失败\n Error: 重复命名,不能覆盖原名称对象.\n 位置:行 " + commandLines[0] + "\n 后续命令未执行"); // 解决命名重复的问题
|
||
}
|
||
curve.m_Name = QString::fromStdString(name);
|
||
curve.m_Full = false;
|
||
|
||
LineDone(commandLines);
|
||
if (commandLines.empty())
|
||
{
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
}
|
||
Point3D_M tp2d_DP; // 20180101 added by czb, 梁拱DP点坐标
|
||
curve.m_Src.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_KnotID.resize(ModelData::ARRAY_SIZE_NORMAL); // 20170501 by czb
|
||
curve.m_KnotDir.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_KnotDirII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_KnotAX.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_KnotAY.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_KnotAZ.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_KnotAXII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_KnotAYII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_KnotAZII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIKnotX.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIKnotY.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIKnotZ.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIIKnotX.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIIKnotY.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIIKnotZ.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIKnotDir.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIKnotDirII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIIKnotDir.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIIKnotDirII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIKnotAX.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIKnotAY.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIKnotAZ.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIKnotAXII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIKnotAYII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIKnotAZII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIIKnotAXII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIIKnotAYII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
curve.m_ProjIIKnotAZII.resize(ModelData::ARRAY_SIZE_NORMAL);
|
||
switch (curve.m_Type)
|
||
{
|
||
case 0:
|
||
{
|
||
// Curve
|
||
// 参数行-型值点
|
||
std::vector<std::string> linePara1b = StringHelper::GetWords(commandLines[0]);
|
||
|
||
std::string keyword = StringHelper::toUpper(linePara1b[0]);
|
||
if (keyword == "XYZ")
|
||
{
|
||
if (linePara1b.size() < 2)
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Missing parameters.");
|
||
}
|
||
Point3D_M tp;
|
||
curve.m_Type = 5;
|
||
|
||
int n = 0;
|
||
bool formatFlag1 = false;
|
||
bool formatFlag2 = false;
|
||
|
||
for (size_t i = 1; i < linePara1b.size(); i++)
|
||
{
|
||
if (linePara1b[i].front() == '/')
|
||
{
|
||
if (formatFlag1 || formatFlag2)
|
||
throw std::runtime_error(linePara1b[i] + "命令行格式不对");
|
||
formatFlag1 = true;
|
||
}
|
||
if (linePara1b[i].back() == '/')
|
||
{
|
||
if (formatFlag2)
|
||
throw std::runtime_error(linePara1b[i] + "命令行格式不对");
|
||
formatFlag2 = true;
|
||
}
|
||
if (linePara1b[i] == "/-")
|
||
{
|
||
SetKnotAXYZII(curve, n - 1, 0, 0, 0);
|
||
curve.m_KnotDirII[n - 1] = 2;
|
||
}
|
||
else if (linePara1b[i] == "-/")
|
||
{
|
||
SetKnotAXYZ(curve, n, 0, 0, 0);
|
||
curve.m_KnotDir[n] = 2;
|
||
}
|
||
else
|
||
{
|
||
formatFlag1 = false;
|
||
formatFlag2 = false;
|
||
tp = Point3D_M();
|
||
ParsePointLoc(tp, linePara1b[i], true);
|
||
|
||
if (tp.m_ID == 0)
|
||
{
|
||
tp.m_ID = GenerateObjectID(&tp);
|
||
//addPointIfNotExists(pointList, tp);
|
||
}
|
||
curve.m_Src[n] = tp.m_ID;
|
||
curve.m_KnotID[n] = tp.m_ID;
|
||
addPointIfNotExists(pointList,tp);
|
||
n++;
|
||
}
|
||
}
|
||
if (n < 2)
|
||
{
|
||
throw std::runtime_error("曲线节点数不可小于2.");
|
||
}
|
||
}
|
||
else if (keyword == "X" || keyword == "Y" || keyword == "Z")
|
||
{
|
||
// 单向投影
|
||
int n = 0;
|
||
curve.m_Type = 5;
|
||
if (linePara1b.size() != 2)
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Missing parameters.");
|
||
}
|
||
Point3D_M tp;
|
||
std::string dir1 = StringHelper::toUpper(linePara1b[0]);
|
||
double offset = 10000;
|
||
tp = ParseLoc(linePara1b, dir1, offset);
|
||
|
||
if (tp.m_ID != 0 || (tp.m_ID == 0 && tp.m_Src.size() > 0))
|
||
{
|
||
if (tp.m_ID == 0)
|
||
{
|
||
tp.m_ID = GenerateObjectID(&tp);
|
||
addPointIfNotExists(pointList,tp);
|
||
// if (tempCmd)
|
||
// {
|
||
// tempObj.push_back(&tp);
|
||
// }
|
||
// else
|
||
// {
|
||
// // Add2ModelOrInteract(tp);
|
||
// }
|
||
}
|
||
curve.m_Src[n++] = tp.m_ID;
|
||
}
|
||
|
||
if (dir1 == "X")
|
||
curve.m_ProjIDir = 0;
|
||
else if (dir1 == "Y")
|
||
curve.m_ProjIDir = 1;
|
||
else if (dir1 == "Z")
|
||
curve.m_ProjIDir = 2;
|
||
else
|
||
throw std::runtime_error("ErrorParameterException: Invalid direction.");
|
||
|
||
LineDone(commandLines);
|
||
if (commandLines.empty())
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
|
||
linePara1b = StringHelper::GetWords(commandLines[0]);
|
||
std::string dir2 = StringHelper::toUpper(linePara1b[0]);
|
||
if (!((dir1 == "X" && dir2 == "YZ") || (dir1 == "Y" && dir2 == "XZ") || (dir1 == "Z" && dir2 == "XY")))
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Invalid direction.");
|
||
}
|
||
SetKnotValue(linePara1b, curve, pointList, offset, dir1, 0);
|
||
if (curve.m_ProjIKnotCnt < 2)
|
||
{
|
||
throw std::runtime_error("曲线节点数不可小于2.");
|
||
}
|
||
}
|
||
else if (keyword == "YZ" || keyword == "XZ" || keyword == "XY")
|
||
{
|
||
// 双向投影
|
||
curve.m_Type = 4;
|
||
if(linePara1b.size() < 2)
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Missing parameters.");
|
||
}
|
||
string pdir1 = StringHelper::toUpper(linePara1b[0]);
|
||
string Ldir1 = "";
|
||
if (pdir1 == "YZ")
|
||
{
|
||
curve.m_ProjIDir = 0;
|
||
Ldir1 = "X";
|
||
}
|
||
else if (pdir1 == "XZ")
|
||
{
|
||
curve.m_ProjIDir = 1;
|
||
Ldir1 = "Y";
|
||
}
|
||
else if (pdir1 == "XY")
|
||
{
|
||
curve.m_ProjIDir = 2;
|
||
Ldir1 = "Z";
|
||
}
|
||
else
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Invalid direction.");
|
||
}
|
||
//双向投影的第一个位置面
|
||
SetKnotValue(linePara1b, curve, pointList, 0, Ldir1, 1);
|
||
if(curve.m_ProjIKnotCnt < 2)
|
||
{
|
||
throw std::runtime_error("曲线节点数不可小于2.");
|
||
}
|
||
LineDone(commandLines);
|
||
// 投影面II
|
||
if (commandLines.empty())
|
||
{
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
}
|
||
linePara1b = StringHelper::GetWords(commandLines[0]);
|
||
if(linePara1b.size() < 2)
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Missing parameters.");
|
||
}
|
||
std::string pdir2 = StringHelper::toUpper(linePara1b[0]);
|
||
std::string Ldir2 = "";
|
||
if (pdir2 == "YZ")
|
||
{
|
||
curve.m_ProjIIDir = 0;
|
||
Ldir2 = "X";
|
||
}
|
||
else if (pdir2 == "XZ")
|
||
{
|
||
curve.m_ProjIIDir = 1;
|
||
Ldir2 = "Y";
|
||
}
|
||
else if (pdir2 == "XY")
|
||
{
|
||
curve.m_ProjIIDir = 2;
|
||
Ldir2 = "Z";
|
||
}
|
||
else
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Invalid direction.");
|
||
}
|
||
if(curve.m_ProjIDir == curve.m_ProjIIDir)
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Invalid direction.");
|
||
}
|
||
//双向投影的第二个位置面
|
||
SetKnotValue(linePara1b, curve, pointList, 0, Ldir2, 2);
|
||
if(curve.m_ProjIIKnotCnt < 2)
|
||
{
|
||
throw std::runtime_error("曲线节点数不可小于2.");
|
||
}
|
||
}
|
||
else if(keyword == "THR")
|
||
{
|
||
std::string surfaceBound = StringHelper::toUpper(commandLines[0]);
|
||
int sid = DataManager::GetObjectIDByName(surfaceBound);
|
||
curve.m_Src[0] = sid;
|
||
curve.m_Type = 15;
|
||
}
|
||
|
||
|
||
LineDone(commandLines);
|
||
// 参数行-POLY
|
||
if(commandLines.size()>0)
|
||
{
|
||
std::vector<string> lineParaPoly = StringHelper::GetWords(commandLines[0]);
|
||
string firstWord = StringHelper::FirstWord(lineParaPoly[0]);
|
||
if(firstWord == "POLY")
|
||
{
|
||
if(curve.m_Type ==4)// 双投影曲线
|
||
{
|
||
for(int i = 0 ; i< curve.m_ProjIKnotCnt-1;i++)
|
||
{
|
||
curve.m_ProjIKnotDir[i] = 2;
|
||
curve.m_ProjIKnotDirII[i] = 2;
|
||
}
|
||
for(int i = 0 ; i< curve.m_ProjIIKnotCnt-1;i++)
|
||
{
|
||
curve.m_ProjIIKnotDir[i] = 2;
|
||
curve.m_ProjIIKnotDirII[i] = 2;
|
||
}
|
||
|
||
}
|
||
else// 样条
|
||
{
|
||
for(int i = 0 ; i>curve.m_KnotID.size()-1;i++)
|
||
{
|
||
if(curve.m_KnotID[i] != 0 && curve.m_KnotID[i+1] != 0)
|
||
{
|
||
curve.m_KnotDir[i] = 2;
|
||
curve.m_KnotDirII[i] = 2;
|
||
}
|
||
}
|
||
}
|
||
LineDone(commandLines);
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
case 2:
|
||
{
|
||
double loc_Ellipse = 10000;
|
||
// bool bRef = false;
|
||
std::vector<std::string> linePara1e = StringHelper::GetWords(commandLines[0]);
|
||
std::string dir_Ellipse = StringHelper::toUpper(linePara1e[0]);
|
||
if (dir_Ellipse == "X" || dir_Ellipse == "Y" || dir_Ellipse == "Z")
|
||
{
|
||
if (linePara1e.size() != 2)
|
||
{
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
}
|
||
ParseLoc(linePara1e, linePara1e[0], loc_Ellipse);
|
||
}
|
||
else if (dir_Ellipse == "DP")
|
||
{
|
||
if (linePara1e.size() != 2)
|
||
{
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
}
|
||
ParsePointLoc(tp2d_DP, linePara1e[1], true); // 得到甲板边点位置 20170308 by czb
|
||
}
|
||
else
|
||
{
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
}
|
||
|
||
LineDone(commandLines);
|
||
if (commandLines.empty())
|
||
{
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
}
|
||
linePara1e = StringHelper::GetWords(commandLines[0]);
|
||
if (StringHelper::toUpper(linePara1e[0]) == "CENTER")
|
||
{
|
||
curve.m_Type = 2;
|
||
if (linePara1e.size() != 2)
|
||
{
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
}
|
||
Point3D_M tp;
|
||
ParsePointLoc2D(tp, linePara1e[1], dir_Ellipse, loc_Ellipse);
|
||
tp.m_ID = GenerateObjectID(&tp);
|
||
// Add2ModelOrInteract(tp);
|
||
curve.m_OX = tp.m_X;
|
||
curve.m_OY = tp.m_Y;
|
||
curve.m_OZ = tp.m_Z;
|
||
curve.m_VX = tp.m_X;
|
||
curve.m_VY = tp.m_Y;
|
||
curve.m_VZ = tp.m_Z;
|
||
if (dir_Ellipse == "X")
|
||
{
|
||
curve.m_VX += 1;
|
||
}
|
||
else if (dir_Ellipse == "Y")
|
||
{
|
||
curve.m_VY += 1;
|
||
}
|
||
else if (dir_Ellipse == "Z")
|
||
{
|
||
curve.m_VZ += 1;
|
||
}
|
||
LineDone(commandLines);
|
||
if (commandLines.empty())
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
std::vector<std::string> linePara1b = StringHelper::GetWords(commandLines[0]);
|
||
if (StringHelper::toUpper(linePara1b[0]) != "R" || linePara1b.size() < 2 || linePara1b.size() > 3)
|
||
{
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
}
|
||
if (!IsPositiveDouble(linePara1b[1])) // 20161011 by czb
|
||
{
|
||
throw std::runtime_error("椭圆弧半径(R)应为正实数.");
|
||
}
|
||
curve.m_R1 = std::stod(linePara1b[1]);
|
||
if (linePara1b.size() == 3)
|
||
{
|
||
if (!IsPositiveDouble(linePara1b[2])) // 20161011 by czb
|
||
{
|
||
throw std::runtime_error("椭圆弧半径(R2)应为正实数.");
|
||
}
|
||
curve.m_R2 = std::stod(linePara1b[2]);
|
||
}
|
||
else
|
||
{
|
||
curve.m_R2 = curve.m_R1;
|
||
}
|
||
if (curve.m_R1 <= 0 || curve.m_R2 <= 0)
|
||
{
|
||
std::runtime_error("椭圆弧半径(R)应大于0.");
|
||
}
|
||
|
||
// 参数行-ANGLE
|
||
curve.m_A1 = 0;
|
||
curve.m_A2 = 360;
|
||
if (commandLines.size() > 1)
|
||
{
|
||
LineDone(commandLines);
|
||
std::vector<std::string> lineParaagl = StringHelper::GetWords(commandLines[0]);
|
||
if (StringHelper::toUpper(lineParaagl[0]) != "ANGLE") // 20161011 by czb
|
||
{
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
}
|
||
if (lineParaagl.size() != 3)
|
||
{
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
}
|
||
curve.m_A1 = std::stod(lineParaagl[1]);
|
||
curve.m_A2 = std::stod(lineParaagl[2]);
|
||
if (curve.m_A1 < -360 || curve.m_A1 > 360 || curve.m_A2 < -360 || curve.m_A2 > 360) // 20161011 by czb
|
||
{
|
||
throw std::runtime_error("椭圆弧角度(ANGLE)值范围应为[-360,360].");
|
||
}
|
||
}
|
||
|
||
// 起始端点
|
||
tp = Point3D_M();
|
||
tp.m_Type = 0;
|
||
if (dir_Ellipse == "X")
|
||
{
|
||
tp.m_X = curve.m_OX;
|
||
tp.m_Y = curve.m_OY + curve.m_R1 * cos(curve.m_A1 * Degree);
|
||
tp.m_Z = curve.m_OZ + curve.m_R2 * sin(curve.m_A1 * Degree);
|
||
}
|
||
else if (dir_Ellipse == "Y")
|
||
{
|
||
tp.m_X = curve.m_OX + curve.m_R1 * cos(curve.m_A1 * Degree);
|
||
tp.m_Y = curve.m_OY;
|
||
tp.m_Z = curve.m_OZ + curve.m_R2 * sin(curve.m_A1 * Degree);
|
||
}
|
||
else if (dir_Ellipse == "Z")
|
||
{
|
||
tp.m_X = curve.m_OX + curve.m_R1 * cos(curve.m_A1 * Degree);
|
||
tp.m_Y = curve.m_OY + curve.m_R2 * sin(curve.m_A1 * Degree);
|
||
tp.m_Z = curve.m_OZ;
|
||
}
|
||
tp.m_ID = GenerateObjectID(&tp);
|
||
addPointIfNotExists(pointList,tp);
|
||
// if (tempCmd)
|
||
// {
|
||
// this->tempObj.push_back(static_cast<IModel *>(&tp));
|
||
// }
|
||
// else
|
||
// {
|
||
// // Add2ModelOrInteract(tp);
|
||
// }
|
||
curve.m_KnotID[0] = tp.m_ID; // 20170501 by czb
|
||
curve.m_Src[0] = tp.m_ID;
|
||
|
||
// 结束端点
|
||
tp = Point3D_M();
|
||
tp.m_Type = 0;
|
||
if (dir_Ellipse == "X")
|
||
{
|
||
tp.m_X = curve.m_OX;
|
||
tp.m_Y = curve.m_OY + curve.m_R1 * cos(curve.m_A2 * Degree);
|
||
tp.m_Z = curve.m_OZ + curve.m_R2 * sin(curve.m_A2 * Degree);
|
||
}
|
||
else if (dir_Ellipse == "Y")
|
||
{
|
||
tp.m_X = curve.m_OX + curve.m_R1 * cos(curve.m_A2 * Degree);
|
||
tp.m_Y = curve.m_OY;
|
||
tp.m_Z = curve.m_OZ + curve.m_R2 * sin(curve.m_A2 * Degree);
|
||
}
|
||
else if (dir_Ellipse == "Z")
|
||
{
|
||
tp.m_X = curve.m_OX + curve.m_R1 * cos(curve.m_A2 * Degree);
|
||
tp.m_Y = curve.m_OY + curve.m_R2 * sin(curve.m_A2 * Degree);
|
||
tp.m_Z = curve.m_OZ; // Assuming "m_OZ" is the correct member of Curve_M
|
||
}
|
||
tp.m_ID = GenerateObjectID(&tp);
|
||
addPointIfNotExists(pointList,tp);
|
||
// if (tempCmd)
|
||
// {
|
||
// this->tempObj.push_back(static_cast<IModel *>(&tp));
|
||
// }
|
||
// else
|
||
// {
|
||
// // Add2ModelOrInteract(tp);
|
||
// }
|
||
curve.m_KnotID[1] = tp.m_ID; // 20170501 by czb
|
||
curve.m_Src[1] = tp.m_ID; // Corrected to use m_ID
|
||
}
|
||
else if (StringHelper::toUpper(linePara1e[0]) == "LOC")
|
||
{
|
||
curve.m_Type = 7;
|
||
if (linePara1e.size() != 4)
|
||
{
|
||
throw std::runtime_error("MissingParameterException: Missing parameters.");
|
||
}
|
||
Point3D_M tp2d1 = Point3D_M();
|
||
ParsePointLoc2D(tp2d1, linePara1e[1], dir_Ellipse, loc_Ellipse);
|
||
tp2d1.m_ID = GenerateObjectID(&tp2d1);
|
||
addPointIfNotExists(pointList,tp2d1);
|
||
// Add2ModelOrInteract(tp2d1);
|
||
curve.m_Src[0] = tp2d1.m_ID;
|
||
curve.m_KnotID[0] = tp2d1.m_ID; // 20170501 by czb,第1点
|
||
curve.m_P1X = tp2d1.m_X; // Assuming m_P1X is the correct member of Curve_M
|
||
curve.m_P1Y = tp2d1.m_Y; // Assuming m_P1Y is the correct member of Curve_M
|
||
curve.m_P1Z = tp2d1.m_Z; // Assuming m_P1Z and m_Z are the correct members
|
||
Point3D_M tp2d2 = Point3D_M();
|
||
ParsePointLoc2D(tp2d2, linePara1e[2], dir_Ellipse, loc_Ellipse);
|
||
tp2d2.m_ID = GenerateObjectID(&tp2d2);
|
||
addPointIfNotExists(pointList,tp2d2);
|
||
// Add2ModelOrInteract(tp2d2);
|
||
curve.m_Src[1] = tp2d2.m_ID;
|
||
curve.m_KnotID[1] = tp2d2.m_ID; // 20170501 by czb,第2点
|
||
curve.m_OX = tp2d2.m_X;
|
||
curve.m_OY = tp2d2.m_Y;
|
||
curve.m_OZ = tp2d2.m_Z;
|
||
Point3D_M tp2d3 = Point3D_M();
|
||
ParsePointLoc2D(tp2d3, linePara1e[3], dir_Ellipse, loc_Ellipse);
|
||
tp2d3.m_ID = GenerateObjectID(&tp2d3);
|
||
addPointIfNotExists(pointList,tp2d3);
|
||
// Add2ModelOrInteract(tp2d3);
|
||
curve.m_Src[2] = tp2d3.m_ID;
|
||
curve.m_KnotID[2] = tp2d3.m_ID; // 20170501 by czb,第3点
|
||
curve.m_P2X = tp2d3.m_X; // Assuming m_P2X is the correct member of Curve_M
|
||
curve.m_P2Y = tp2d3.m_Y;
|
||
curve.m_P2Z = tp2d3.m_Z;
|
||
}
|
||
else if (StringHelper::toUpper(linePara1e[0]) == "BFY")
|
||
{
|
||
curve.m_Type = 2; // Corrected member name
|
||
std::vector<std::string> linePararw = linePara1e;
|
||
if (linePararw.size() < 3 || linePararw.size() > 4)
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Invalid number of parameters.");
|
||
}
|
||
if (!IsPositiveDouble(linePararw[1]))
|
||
{
|
||
throw std::runtime_error("ErrorSyntaxException: 梁拱宽度B应为实数");
|
||
}
|
||
if (!IsPositiveDouble(linePararw[2]))
|
||
{
|
||
throw std::runtime_error("ErrorSyntaxException: 梁拱宽度f应为实数");
|
||
}
|
||
if (linePararw.size() == 4 && !IsPositiveDouble(linePararw[3]))
|
||
{
|
||
throw std::runtime_error("ErrorSyntaxException: 梁拱中心Yc应为实数");
|
||
}
|
||
double B = std::stod(linePararw[1]); // 参考宽度
|
||
double f = std::stod(linePararw[2]); // 参考高度
|
||
double Yc = linePararw.size() == 4 ? std::stod(linePararw[3]) : 0.0; // 甲板中心
|
||
if (B == 0 || std::abs(B) < 2 * std::abs(f)) // Replaced Math.Abs with std::abs
|
||
{
|
||
throw std::runtime_error("梁拱宽度B不能为0,也不能小于梁拱高度f的2倍."); // Replaced ErrorSyntaxException with std::runtime_error
|
||
}
|
||
Point3D_M tp2d = tp2d_DP; // Corrected type to match Point3D_M
|
||
double w = (tp2d.m_Y - Yc); // 实际宽度,区分正负
|
||
if (std::abs(w) - std::abs(B / 2) > 0.0001) // 20171001 modified by czb // cqr-20180420-2 甲板边点的编号n=1或n=-1选错的情况很常见,将这两种情况分开,使错误提示更准确
|
||
{
|
||
throw std::runtime_error("根据DP和Yc计算所得的梁拱实际宽度w,不能大于0.5倍参考宽度B.");
|
||
}
|
||
|
||
if (std::abs(w) < 0.0001) // 20171001 modified by czb // cqr-20180420-2 甲板边点的编号n=1或n=-1选错的情况很常见,将这两种情况分开,使错误提示更准确
|
||
{
|
||
throw std::runtime_error("甲板边点DP的Y值不能等于Yc,请检查所填甲板边点的数值,是否曲线选错了点(n=-1还是n=1?).");
|
||
}
|
||
|
||
double R, h; // 直径和实际梁拱高度(截取)
|
||
if (f == 0)
|
||
{
|
||
R = std::numeric_limits<double>::infinity(); // Replaced with C++ equivalent
|
||
h = 0;
|
||
}
|
||
else
|
||
{
|
||
R = GetCircleRadius(B, f); // Ensure GetCircleRadius is declared and implemented
|
||
if (R <= 0)
|
||
{
|
||
throw std::runtime_error("椭圆弧半径(R)应大于0.");
|
||
}
|
||
h = GetCircleH(R, w, f); // 实际高度,区分正负
|
||
}
|
||
curve.m_R1 = curve.m_R2 = R; // Corrected member names
|
||
// 20171001 modifed by czb,end
|
||
|
||
// 20161010 end by czb
|
||
|
||
if (commandLines.size() > 1) // Corrected to use std::vector's size() method
|
||
{
|
||
// LineDone(commandLines); //cqr-20180420-1 应在有FULL时才读下一行命令
|
||
std::vector<std::string> str = StringHelper::GetWords(commandLines[1]); // cqr-20181012 FULL在第2行 应为[1]
|
||
if (StringHelper::toUpper(str[0]) == "FULL")
|
||
{
|
||
LineDone(commandLines); // cqr-20180420-1 应在有FULL时才读下一行命令
|
||
curve.m_Full = true;
|
||
}
|
||
}
|
||
|
||
if (f != 0) // 20171001 added by czb
|
||
{
|
||
// 20161010 begin by czb
|
||
|
||
// 计算圆心位置,并保存到tp2dCenter
|
||
Point3D_M tp2dCenter; // Corrected type and removed invalid new keyword
|
||
tp2dCenter.m_X = tp2d.m_X;
|
||
tp2dCenter.m_Y = tp2d.m_Y - w;
|
||
if (h > 0)
|
||
{
|
||
tp2dCenter.m_Z = tp2d.m_Z - std::sqrt(curve.m_R1 * curve.m_R1 - w * w);
|
||
}
|
||
else
|
||
{
|
||
tp2dCenter.m_Z = tp2d.m_Z + std::sqrt(curve.m_R1 * curve.m_R1 - w * w);
|
||
}
|
||
// 20161010 end by czb
|
||
tp2dCenter.m_ID = GenerateObjectID(&tp2dCenter); // Corrected syntax
|
||
addPointIfNotExists(pointList,tp2dCenter); // Corrected syntax
|
||
// AddToModelOrInteract(tp2dCenter); // Ensure AddToModelOrInteract is declared and implemented
|
||
curve.m_OX = tp2dCenter.m_X;
|
||
curve.m_OY = tp2dCenter.m_Y;
|
||
curve.m_OZ = tp2dCenter.m_Z;
|
||
curve.m_VX = tp2dCenter.m_X;
|
||
curve.m_VY = tp2dCenter.m_Y;
|
||
curve.m_VZ = tp2dCenter.m_Z;
|
||
|
||
curve.m_VX += 1;
|
||
// 20161010 by czb
|
||
curve.m_A1 = 0;
|
||
curve.m_A2 = 360;
|
||
double a = GetCircleAngle(curve.m_R1, w, h);
|
||
|
||
// 20161010 by czb
|
||
if (w > 0 && h > 0) // 第一象限
|
||
{
|
||
curve.m_A1 = 90 - a;
|
||
curve.m_A2 = curve.m_Full ? 90 + a : 90;
|
||
}
|
||
if (w < 0 && h > 0) // 第二象限
|
||
{
|
||
curve.m_A1 = curve.m_Full ? 90 - a : 90;
|
||
curve.m_A2 = 90 + a;
|
||
}
|
||
if (w > 0 && h < 0) // 第四象限
|
||
{
|
||
curve.m_A1 = curve.m_Full ? 270 - a : 270;
|
||
curve.m_A2 = 270 + a;
|
||
}
|
||
if (w < 0 && h < 0) // 第三象限
|
||
{
|
||
curve.m_A1 = 270 - a;
|
||
curve.m_A2 = curve.m_Full ? 270 + a : 270;
|
||
}
|
||
}
|
||
|
||
Point3D_M tp = tp2d; // 20170701 by czb
|
||
tp.m_ID = GenerateObjectID(&tp);
|
||
addPointIfNotExists(pointList,tp); // Corrected syntax
|
||
curve.m_KnotID[0] = tp.m_ID; // 20170501 by czb
|
||
curve.m_Src[0] = tp.m_ID;
|
||
|
||
// 结束端点
|
||
tp = Point3D_M();
|
||
tp.m_Type = 0;
|
||
if (f == 0) // 20171001 added by czb
|
||
{
|
||
curve.m_Type = 5;
|
||
tp.m_X = tp2d.m_X;
|
||
tp.m_Y = tp2d.m_Y - ((curve.m_Full ? 2 : 1) * w);
|
||
tp.m_Z = tp2d.m_Z;
|
||
}
|
||
else
|
||
{
|
||
tp.m_X = curve.m_OX;
|
||
tp.m_Y = curve.m_OY + curve.m_R1 * std::cos(curve.m_A2 * Degree);
|
||
tp.m_Z = curve.m_OZ + curve.m_R2 * std::sin(curve.m_A2 * Degree);
|
||
}
|
||
tp.m_ID = GenerateObjectID(&tp);
|
||
addPointIfNotExists(pointList,tp); // Corrected syntax
|
||
curve.m_KnotID[1] = tp.m_ID; // 20170501 by czb
|
||
curve.m_Src[1] = tp.m_ID;
|
||
}
|
||
}
|
||
break;
|
||
case 3:
|
||
{
|
||
// Parabola
|
||
std::vector<std::string> linePara1e = StringHelper::GetWords(commandLines[0]);
|
||
std::string dir_Ellipse = StringHelper::toUpper(linePara1e[0]);
|
||
double loc_Ellipse = 0.0;
|
||
if (dir_Ellipse == "X" || dir_Ellipse == "Y" || dir_Ellipse == "Z")
|
||
{
|
||
if (linePara1e.size() != 2)
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Invalid number of parameters.");
|
||
}
|
||
ParseLoc(linePara1e, linePara1e[0], loc_Ellipse);
|
||
}
|
||
else if (dir_Ellipse == "DP")
|
||
{
|
||
if (linePara1e.size() != 2)
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Invalid number of parameters.");
|
||
}
|
||
ParsePointLoc(tp2d_DP, linePara1e[1], true); // 得到甲板边点位置, 20180101 modified by czb,调整到这里
|
||
}
|
||
else
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Invalid direction.");
|
||
}
|
||
|
||
LineDone(commandLines);
|
||
linePara1e = StringHelper::GetWords(commandLines[0]);
|
||
|
||
if (StringHelper::toUpper(linePara1e[0]) == "LOC") // 三点
|
||
{
|
||
if (linePara1e.size() != 4)
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Invalid number of parameters.");
|
||
}
|
||
Point3D_M tp2d1;
|
||
ParsePointLoc2D(tp2d1, linePara1e[1], dir_Ellipse, loc_Ellipse);
|
||
tp2d1.m_ID = GenerateObjectID(&tp2d1);
|
||
addPointIfNotExists(pointList,tp2d1);
|
||
// Add2ModelOrInteract(tp2d1);
|
||
curve.m_Src[0] = tp2d1.m_ID;
|
||
curve.m_KnotID[0] = tp2d1.m_ID;
|
||
curve.m_P1X = tp2d1.m_X;
|
||
curve.m_P1Y = tp2d1.m_Y;
|
||
curve.m_P1Z = tp2d1.m_Z;
|
||
|
||
Point3D_M tp2d2;
|
||
ParsePointLoc2D(tp2d2, linePara1e[2], dir_Ellipse, loc_Ellipse);
|
||
tp2d2.m_ID = GenerateObjectID(&tp2d2);
|
||
addPointIfNotExists(pointList,tp2d2);
|
||
// Add2ModelOrInteract(tp2d2);
|
||
curve.m_Src[1] = tp2d2.m_ID;
|
||
curve.m_KnotID[1] = tp2d2.m_ID;
|
||
curve.m_OX = tp2d2.m_X;
|
||
curve.m_OY = tp2d2.m_Y;
|
||
curve.m_OZ = tp2d2.m_Z;
|
||
curve.m_SplitX = tp2d2.m_X;
|
||
curve.m_SplitY = tp2d2.m_Y;
|
||
curve.m_SplitZ = tp2d2.m_Z;
|
||
|
||
Point3D_M tp2d3;
|
||
ParsePointLoc2D(tp2d3, linePara1e[3], dir_Ellipse, loc_Ellipse);
|
||
tp2d3.m_ID = GenerateObjectID(&tp2d3);
|
||
addPointIfNotExists(pointList,tp2d3);
|
||
// Add2ModelOrInteract(tp2d3);
|
||
curve.m_Src[2] = tp2d3.m_ID;
|
||
curve.m_KnotID[2] = tp2d3.m_ID;
|
||
curve.m_P2X = tp2d3.m_X;
|
||
curve.m_P2Y = tp2d3.m_Y;
|
||
curve.m_P2Z = tp2d3.m_Z;
|
||
}
|
||
else if (StringHelper::toUpper(linePara1e[0]) == "BFY") // 梁拱
|
||
{
|
||
std::vector<std::string> linePararw = linePara1e;
|
||
if (linePararw.size() < 3 || linePararw.size() > 4)
|
||
{
|
||
throw std::runtime_error("ErrorParameterException: Invalid number of parameters.");
|
||
}
|
||
if (!IsPositiveDouble(linePararw[1]))
|
||
{
|
||
throw std::runtime_error("ErrorSyntaxException: 梁拱宽度B应为实数");
|
||
}
|
||
if (!IsPositiveDouble(linePararw[2]))
|
||
{
|
||
throw std::runtime_error("ErrorSyntaxException: 梁拱宽度f应为实数");
|
||
}
|
||
if (linePararw.size() == 4 && !IsPositiveDouble(linePararw[3]))
|
||
{
|
||
throw std::runtime_error("ErrorSyntaxException: 梁拱中心Yc应为实数");
|
||
}
|
||
|
||
double B = std::stod(linePararw[1]); // 参考高度
|
||
double f = std::stod(linePararw[2]); // 参考高度
|
||
double Yc = linePararw.size() == 4 ? std::stod(linePararw[3]) : 0.0; // 甲板中心
|
||
if (B == 0 || std::abs(B) < 2 * std::abs(f))
|
||
{
|
||
throw std::runtime_error("梁拱宽度B不能为0,也不能小于梁拱高度f的2倍.");
|
||
}
|
||
Point3D_M tp2d = tp2d_DP;
|
||
double w = (tp2d.m_Y - Yc); // 实际宽度,区分正负
|
||
if (std::abs(w) - std::abs(B / 2) > 0.0001) // 20171001 modified by czb // cqr-20180420-2 甲板边点的编号n=1或n=-1选错的情况很常见,将这两种情况分开,使错误提示更准确
|
||
{
|
||
throw std::runtime_error("根据DP和Yc计算所得的梁拱实际宽度w,不能大于0.5倍参考宽度B.");
|
||
}
|
||
|
||
if (std::abs(w) < 0.0001) // 20171001 modified by czb // cqr-20180420-2 甲板边点的编号n=1或n=-1选错的情况很常见,将这两种情况分开,使错误提示更准确
|
||
{
|
||
throw std::runtime_error("甲板边点DP的Y值不能等于Yc,请检查所填甲板边点的数值,是否曲线选错了点(n=-1还是n=1?).");
|
||
}
|
||
|
||
if (f != 0) // 20171001 added by czb
|
||
{
|
||
double h = GetParabolaH(B, f, w);
|
||
{
|
||
curve.m_P1X = tp2d.m_X;
|
||
curve.m_P1Y = tp2d.m_Y;
|
||
curve.m_P1Z = tp2d.m_Z;
|
||
curve.m_OX = tp2d.m_X;
|
||
curve.m_OY = tp2d.m_Y - w;
|
||
curve.m_OZ = tp2d.m_Z + h;
|
||
curve.m_P2X = tp2d.m_X;
|
||
curve.m_P2Y = tp2d.m_Y - w * 2;
|
||
curve.m_P2Z = tp2d.m_Z;
|
||
}
|
||
}
|
||
// 20161011 end by czb
|
||
|
||
if (commandLines.size() > 1)
|
||
{
|
||
// LineDone(commandLines); //cqr-20180420-1 应在有FULL时才读下一行命令
|
||
std::vector<std::string> str = StringHelper::GetWords(commandLines[1]); // cqr-20181012 FULL在第2行 应为[1]
|
||
if (StringHelper::toUpper(str[0]) == "FULL")
|
||
{
|
||
LineDone(commandLines); // cqr-20180420-1 应在有FULL时才读下一行命令
|
||
curve.m_Full = true;
|
||
}
|
||
}
|
||
|
||
// 起始端点
|
||
Point3D_M tp = tp2d;
|
||
tp.m_ID = GenerateObjectID(&tp);
|
||
|
||
addPointIfNotExists(pointList,tp); // Corrected syntax
|
||
curve.m_KnotID[0] = tp.m_ID; // 20170501 by czb
|
||
curve.m_Src[0] = tp.m_ID;
|
||
|
||
// 结束端点
|
||
tp = Point3D_M();
|
||
tp.m_Type = 0;
|
||
if (f != 0) // 20171001 modified by czb
|
||
{
|
||
|
||
if (curve.m_Full)
|
||
{
|
||
tp.m_X = curve.m_P2X;
|
||
tp.m_Y = curve.m_P2Y;
|
||
tp.m_Z = curve.m_P2Z;
|
||
}
|
||
else
|
||
{
|
||
tp.m_X = curve.m_OX;
|
||
tp.m_Y = curve.m_OY;
|
||
tp.m_Z = curve.m_OZ;
|
||
}
|
||
}
|
||
else // 20171001 added by czb
|
||
{
|
||
curve.m_Type = 5;
|
||
tp.m_X = tp2d.m_X;
|
||
tp.m_Y = tp2d.m_Y - (curve.m_Full ? 2 : 1) * w;
|
||
tp.m_Z = tp2d.m_Z;
|
||
}
|
||
tp.m_ID = GenerateObjectID(&tp);
|
||
addPointIfNotExists(pointList,tp); // Corrected syntax
|
||
|
||
curve.m_KnotID[1] = tp.m_ID; // 20170501 by czb
|
||
curve.m_Src[1] = tp.m_ID;
|
||
}
|
||
LineDone(commandLines);
|
||
}
|
||
break;
|
||
}
|
||
//采用引用已经设置了所有的curve属性.
|
||
// if (tempCmd)
|
||
// {
|
||
// // this.tempObj.Add(curve);
|
||
// }
|
||
// else
|
||
// {
|
||
// }
|
||
curve.m_Command = QString::fromStdString(cmd);
|
||
Add2ModelOrInteractWithIdtf(&curve);
|
||
}
|
||
|
||
void CurveInterpreter::LineDone(std::vector<std::string> &commandLines)
|
||
{
|
||
if (!commandLines.empty())
|
||
{
|
||
PrevCommandLine = commandLines[0];
|
||
cmd += LINE_SPLITTER;
|
||
cmd += commandLines[0];
|
||
commandLines.erase(commandLines.begin());
|
||
}
|
||
}
|
||
|
||
bool CurveInterpreter::IsPositiveDouble(const std::string &str)
|
||
{
|
||
std::regex pattern("^\\d*(\\.\\d*)?$");
|
||
return std::regex_match(str, pattern);
|
||
}
|
||
|
||
double CurveInterpreter::GetCircleRadius(double B, double f)
|
||
{
|
||
B = std::abs(B);
|
||
f = std::abs(f);
|
||
return (std::pow(B / 2.0, 2) + std::pow(f, 2)) / (2.0 * f);
|
||
}
|
||
|
||
double CurveInterpreter::GetCircleH(double R, double w, double f)
|
||
{
|
||
R = std::abs(R);
|
||
double h = R - std::sqrt(R * R - w * w);
|
||
return (f >= 0 ? 1 : -1) * h;
|
||
}
|
||
|
||
double CurveInterpreter::GetCircleAngle(double R, double w, double h)
|
||
{
|
||
R = std::abs(R);
|
||
w = std::abs(w);
|
||
h = std::abs(h);
|
||
double a = std::atan(w / (R - h));
|
||
a = a * 180.0 / PI;
|
||
return a;
|
||
}
|
||
|
||
double CurveInterpreter::GetParabolaH(double B, double f, double w) {
|
||
double abc[3];
|
||
|
||
abc[0] = -4 * f / (B * B);
|
||
abc[1] = 0;
|
||
abc[2] = f;
|
||
|
||
return f - (abc[0] * w * w + abc[1] * w + abc[2]);
|
||
}
|
||
|
||
void CurveInterpreter::SetKnotAXYZII(Curve_M& curve, int index, double X, double Y, double Z)
|
||
{
|
||
curve.m_KnotAXII[index] = X;
|
||
curve.m_KnotAYII[index] = Y;
|
||
curve.m_KnotAZII[index] = Z;
|
||
}
|
||
|
||
void CurveInterpreter::SetKnotAXYZ(Curve_M& curve, int index, double X, double Y, double Z)
|
||
{
|
||
curve.m_KnotAX[index] = X;
|
||
curve.m_KnotAY[index] = Y;
|
||
curve.m_KnotAZ[index] = Z;
|
||
}
|
||
|
||
|
||
void CurveInterpreter::SetKnotValue(const std::vector<std::string>& linePara1b, Curve_M& curve,std::vector<Point3D_M>& pointList, double offset, const std::string& dir, int type)
|
||
{
|
||
int m = 0;
|
||
std::string str = "";
|
||
bool formatFlag1 = false; // 切出角标志
|
||
bool formatFlag2 = false; // 切入角标志
|
||
|
||
for (size_t i = 1; i < linePara1b.size(); ++i)
|
||
{
|
||
const std::string& token = linePara1b[i];
|
||
|
||
if (token.rfind("/", 0) == 0) // 切出
|
||
{
|
||
if (formatFlag1 || formatFlag2)
|
||
throw std::runtime_error(token + "命令行格式不对"); // 切出标志前不能有切出或切入
|
||
formatFlag1 = true;
|
||
}
|
||
|
||
if (!token.empty() && token.back() == '/') // 切入
|
||
{
|
||
if (formatFlag2)
|
||
throw std::runtime_error(token + "命令行格式不对"); // 不能连续两个切入标志
|
||
formatFlag2 = true;
|
||
}
|
||
|
||
if (token == "/-") // 折点切出
|
||
{
|
||
if (m - 1 < 0 || i == linePara1b.size() - 1)
|
||
throw std::runtime_error("命令行格式不对");
|
||
|
||
if (type == 0) //单向投影线
|
||
{
|
||
SetKnotAXYZII(curve, m - 1, 0, 0, 0);
|
||
curve.m_KnotDirII[m - 1] = 2;
|
||
}
|
||
else if (type == 1) //双向投影第1条
|
||
{
|
||
SetProjIKnotAXYZII(curve, m - 1, 0, 0, 0);
|
||
curve.m_ProjIKnotDirII[m - 1] = 2;
|
||
}
|
||
else //双向投影第2条
|
||
{
|
||
SetProjIIKnotAXYZII(curve, m - 1, 0, 0, 0);
|
||
curve.m_ProjIIKnotDirII[m - 1] = 2;
|
||
}
|
||
|
||
str += " 点序:" + std::to_string(m - 1) + "向量值:" +
|
||
std::to_string(curve.m_KnotAXII[m - 1]) + "," +
|
||
std::to_string(curve.m_KnotAYII[m - 1]) + "," +
|
||
std::to_string(curve.m_KnotAZII[m - 1]) + ";";
|
||
}
|
||
else if (token == "-/") // 折点切入
|
||
{
|
||
if (m - 1 < 0 || i == linePara1b.size() - 1)
|
||
throw std::runtime_error("命令行格式不对");
|
||
|
||
if (type == 0) //平面投影
|
||
{
|
||
SetKnotAXYZ(curve, m, 0, 0, 0);
|
||
curve.m_KnotDir[m] = 2;
|
||
}
|
||
else if (type == 1) //双向投影第1个
|
||
{
|
||
SetProjIKnotAXYZ(curve, m, 0, 0, 0);
|
||
curve.m_ProjIKnotDir[m] = 2;
|
||
}
|
||
else //双向投影第2个
|
||
{
|
||
SetProjIIKnotAXYZ(curve, m, 0, 0, 0);
|
||
curve.m_ProjIIKnotDir[m] = 2;
|
||
}
|
||
|
||
str += " 点序:" + std::to_string(m) + "向量值:" +
|
||
std::to_string(curve.m_KnotAX[m]) + "," +
|
||
std::to_string(curve.m_KnotAY[m]) + "," +
|
||
std::to_string(curve.m_KnotAZ[m]) + ";";
|
||
}
|
||
else if (token.rfind("/", 0) == 0 && token != "/-") // 切出角
|
||
{ //方向矢量KnotAXYZ置置为投影面的法向
|
||
if (m - 1 < 0 || i == linePara1b.size() - 1)
|
||
throw std::runtime_error("命令行格式不对");
|
||
|
||
double ang = std::stod(token.substr(1));
|
||
|
||
if (type == 0) //平面投影
|
||
{
|
||
SetKnotAXYZII(curve, m, dir, ang);
|
||
curve.m_KnotDirII[m - 1] = 1;
|
||
}
|
||
else if (type == 1) //双向投影第一个
|
||
{
|
||
SetProjIKnotAXYZII(curve, m, dir, ang);
|
||
curve.m_ProjIKnotDirII[m - 1] = 1;
|
||
}
|
||
else //双向投影第2个
|
||
{
|
||
SetProjIIKnotAXYZII(curve, m, dir, ang);
|
||
curve.m_ProjIIKnotDirII[m - 1] = 1;
|
||
}
|
||
|
||
str += " 点序:" + std::to_string(m - 1) + "向量值:" +
|
||
std::to_string(curve.m_KnotAXII[m - 1]) + "," +
|
||
std::to_string(curve.m_KnotAYII[m - 1]) + "," +
|
||
std::to_string(curve.m_KnotAZII[m - 1]) + ";";
|
||
}
|
||
else if (!token.empty() && token.back() == '/' && token != "-/") // 切入角
|
||
{
|
||
if (m - 1 < 0 || i == linePara1b.size() - 1)
|
||
throw std::runtime_error("命令行格式不对");
|
||
|
||
double ang = std::stod(token.substr(0, token.size() - 1));
|
||
|
||
if (type == 0) //平面投影
|
||
{
|
||
SetKnotAXYZ(curve, m, dir, ang);
|
||
curve.m_KnotDir[m] = 1;
|
||
}
|
||
else if (type == 1) //双向投影第一个
|
||
{
|
||
SetProjIKnotAXYZ(curve, m, dir, ang);
|
||
curve.m_ProjIKnotDir[m] = 1;
|
||
}
|
||
else //双向投影第2个
|
||
{
|
||
SetProjIIKnotAXYZ(curve, m, dir, ang);
|
||
curve.m_ProjIIKnotDir[m] = 1;
|
||
}
|
||
|
||
str += " 点序:" + std::to_string(m) + "向量值:" +
|
||
std::to_string(curve.m_KnotAX[m]) + "," +
|
||
std::to_string(curve.m_KnotAY[m]) + "," +
|
||
std::to_string(curve.m_KnotAZ[m]) + ";";
|
||
}
|
||
else //节点表达式,重置切入切出标志为FALSE,设置投影面节点坐标ProjKnotIXYZ
|
||
{
|
||
formatFlag1 = false;
|
||
formatFlag2 = false;
|
||
|
||
Point3D_M tp2d;
|
||
ParsePointLoc2D(tp2d, token, dir, offset);
|
||
|
||
if (type == 0)
|
||
{
|
||
tp2d.m_ID = GenerateObjectID(&tp2d);
|
||
// if (tempCmd)
|
||
// // tempObj.push_back(tp2d);
|
||
// else
|
||
// // Add2ModelOrInteract(tp2d);
|
||
addPointIfNotExists(pointList,tp2d);
|
||
|
||
curve.m_Src[m] = tp2d.m_ID;
|
||
curve.m_KnotID[m] = tp2d.m_ID;
|
||
}
|
||
else if (type == 1)
|
||
{
|
||
curve.m_ProjIKnotX[m] = tp2d.m_X;
|
||
curve.m_ProjIKnotY[m] = tp2d.m_Y;
|
||
curve.m_ProjIKnotZ[m] = tp2d.m_Z;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIIKnotX[m] = tp2d.m_X;
|
||
curve.m_ProjIIKnotY[m] = tp2d.m_Y;
|
||
curve.m_ProjIIKnotZ[m] = tp2d.m_Z;
|
||
tp2d.m_ID = GenerateObjectID(&tp2d);
|
||
// if (tempCmd)
|
||
// tempObj.push_back(tp2d);
|
||
// else
|
||
// Add2ModelOrInteract(tp2d);
|
||
addPointIfNotExists(pointList,tp2d);
|
||
|
||
curve.m_Src[m] = tp2d.m_ID;
|
||
curve.m_KnotID[m] = tp2d.m_ID;
|
||
}
|
||
|
||
m++;
|
||
}
|
||
}
|
||
|
||
if (type == 0)
|
||
curve.m_ProjIKnotCnt = m;
|
||
else if (type == 1)
|
||
curve.m_ProjIKnotCnt = m;
|
||
else if (type == 2)
|
||
curve.m_ProjIIKnotCnt = m;
|
||
|
||
}
|
||
|
||
void CurveInterpreter::SetProjIKnotAXYZII(Curve_M& curve, int index, double X, double Y, double Z)
|
||
{
|
||
curve.m_ProjIKnotAXII[index] = X;
|
||
curve.m_ProjIKnotAYII[index] = Y;
|
||
curve.m_ProjIKnotAZII[index] = Z;
|
||
}
|
||
|
||
void CurveInterpreter::SetProjIIKnotAXYZII(Curve_M& curve, int index, double X, double Y, double Z)
|
||
{
|
||
curve.m_ProjIKnotAXII[index] = X;
|
||
curve.m_ProjIKnotAYII[index] = Y;
|
||
curve.m_ProjIKnotAZII[index] = Z;
|
||
}
|
||
|
||
void CurveInterpreter::SetProjIKnotAXYZ(Curve_M& curve, int index, double X, double Y, double Z)
|
||
{
|
||
curve.m_ProjIKnotAX[index] = X;
|
||
curve.m_ProjIKnotAY[index] = Y;
|
||
curve.m_ProjIKnotAZ[index] = Z;
|
||
}
|
||
|
||
void CurveInterpreter::SetProjIIKnotAXYZ(Curve_M& curve, int index, double X, double Y, double Z)
|
||
{
|
||
curve.m_ProjIIKnotAX[index] = X;
|
||
curve.m_ProjIIKnotAY[index] = Y;
|
||
curve.m_ProjIIKnotAZ[index] = Z;
|
||
}
|
||
|
||
void CurveInterpreter::SetKnotAXYZII(Curve_M& curve, int index, const std::string& dir, double ang)
|
||
{
|
||
// 将 ang 归到 0~360 之间
|
||
ang = fmod(ang, 360.0);
|
||
if (ang < 0) ang = 360 + ang;
|
||
|
||
if (dir == "X")
|
||
{
|
||
curve.m_KnotAXII[index - 1] = 0;
|
||
curve.m_KnotAYII[index - 1] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_KnotAZII[index - 1] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_KnotAZII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_KnotAYII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_KnotAYII[index - 1] = 1;
|
||
}
|
||
curve.m_KnotAZII[index - 1] = curve.m_KnotAYII[index - 1] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Y")
|
||
{
|
||
curve.m_KnotAYII[index - 1] = 0;
|
||
curve.m_KnotAXII[index - 1] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_KnotAZII[index - 1] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_KnotAZII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_KnotAXII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_KnotAXII[index - 1] = 1;
|
||
}
|
||
curve.m_KnotAZII[index - 1] = curve.m_KnotAXII[index - 1] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Z")
|
||
{
|
||
curve.m_KnotAZII[index - 1] = 0;
|
||
curve.m_KnotAXII[index - 1] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_KnotAYII[index - 1] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_KnotAYII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_KnotAXII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_KnotAXII[index - 1] = 1;
|
||
}
|
||
curve.m_KnotAYII[index - 1] = curve.m_KnotAXII[index - 1] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
}
|
||
|
||
void CurveInterpreter::SetProjIKnotAXYZII(Curve_M& curve, int index, const std::string& dir, double ang)
|
||
{
|
||
// 将 ang 归到 0~360 之间
|
||
ang = fmod(ang, 360.0);
|
||
if (ang < 0) ang = 360 + ang;
|
||
|
||
if (dir == "X")
|
||
{
|
||
curve.m_ProjIKnotAXII[index - 1] = 0;
|
||
curve.m_ProjIKnotAYII[index - 1] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIKnotAZII[index - 1] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIKnotAZII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIKnotAYII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIKnotAYII[index - 1] = 1;
|
||
}
|
||
curve.m_ProjIKnotAZII[index - 1] = curve.m_ProjIKnotAYII[index - 1] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Y")
|
||
{
|
||
curve.m_ProjIKnotAYII[index - 1] = 0;
|
||
curve.m_ProjIKnotAXII[index - 1] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIKnotAZII[index - 1] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIKnotAZII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIKnotAXII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIKnotAXII[index - 1] = 1;
|
||
}
|
||
curve.m_ProjIKnotAZII[index - 1] = curve.m_ProjIKnotAXII[index - 1] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Z")
|
||
{
|
||
curve.m_ProjIKnotAZII[index - 1] = 0;
|
||
curve.m_ProjIKnotAXII[index - 1] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIKnotAYII[index - 1] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIKnotAYII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIKnotAXII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIKnotAXII[index - 1] = 1;
|
||
}
|
||
curve.m_ProjIKnotAYII[index - 1] = curve.m_ProjIKnotAXII[index - 1] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
}
|
||
|
||
void CurveInterpreter::SetProjIIKnotAXYZII(Curve_M& curve, int index, const std::string& dir, double ang)
|
||
{
|
||
// 将 ang 归到 0~360 之间
|
||
ang = fmod(ang, 360.0);
|
||
if (ang < 0) ang = 360 + ang;
|
||
|
||
if (dir == "X")
|
||
{
|
||
curve.m_ProjIIKnotAXII[index - 1] = 0;
|
||
curve.m_ProjIIKnotAYII[index - 1] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIIKnotAZII[index - 1] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIIKnotAZII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIIKnotAYII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIIKnotAYII[index - 1] = 1;
|
||
}
|
||
curve.m_ProjIIKnotAZII[index - 1] = curve.m_ProjIIKnotAYII[index - 1] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Y")
|
||
{
|
||
curve.m_ProjIIKnotAYII[index - 1] = 0;
|
||
curve.m_ProjIIKnotAXII[index - 1] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIIKnotAZII[index - 1] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIIKnotAZII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIIKnotAXII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIIKnotAXII[index - 1] = 1;
|
||
}
|
||
curve.m_ProjIIKnotAZII[index - 1] = curve.m_ProjIIKnotAXII[index - 1] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Z")
|
||
{
|
||
curve.m_ProjIIKnotAZII[index - 1] = 0;
|
||
curve.m_ProjIIKnotAXII[index - 1] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIIKnotAYII[index - 1] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIIKnotAYII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIIKnotAXII[index - 1] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIIKnotAXII[index - 1] = 1;
|
||
}
|
||
curve.m_ProjIIKnotAYII[index - 1] = curve.m_ProjIIKnotAXII[index - 1] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
}
|
||
|
||
void CurveInterpreter::SetKnotAXYZ(Curve_M& curve, int m, const std::string& dir, double ang)
|
||
{
|
||
// 将 ang 归到 0~360 之间
|
||
ang = fmod(ang, 360.0);
|
||
if (ang < 0) ang = 360 + ang;
|
||
|
||
if (dir == "X")
|
||
{
|
||
curve.m_KnotAX[m] = 0;
|
||
curve.m_KnotAY[m] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_KnotAZ[m] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_KnotAZ[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_KnotAY[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_KnotAY[m] = 1;
|
||
}
|
||
curve.m_KnotAZ[m] = curve.m_KnotAY[m] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Y")
|
||
{
|
||
curve.m_KnotAY[m] = 0;
|
||
curve.m_KnotAX[m] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_KnotAZ[m] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_KnotAZ[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_KnotAX[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_KnotAX[m] = 1;
|
||
}
|
||
curve.m_KnotAZ[m] = curve.m_KnotAX[m] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Z")
|
||
{
|
||
curve.m_KnotAZ[m] = 0;
|
||
curve.m_KnotAX[m] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_KnotAY[m] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_KnotAY[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_KnotAX[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_KnotAX[m] = 1;
|
||
}
|
||
curve.m_KnotAY[m] = curve.m_KnotAX[m] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
}
|
||
|
||
void CurveInterpreter::SetProjIKnotAXYZ(Curve_M& curve, int m, const std::string& dir, double ang)
|
||
{
|
||
// 将 ang 归到 0~360 之间
|
||
ang = fmod(ang, 360.0);
|
||
if (ang < 0) ang = 360 + ang;
|
||
|
||
if (dir == "X")
|
||
{
|
||
curve.m_ProjIKnotAX[m] = 0;
|
||
curve.m_ProjIKnotAY[m] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIKnotAZ[m] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIKnotAZ[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIKnotAY[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIKnotAY[m] = 1;
|
||
}
|
||
curve.m_ProjIKnotAZ[m] = curve.m_ProjIKnotAY[m] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Y")
|
||
{
|
||
curve.m_ProjIKnotAY[m] = 0;
|
||
curve.m_ProjIKnotAX[m] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIKnotAZ[m] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIKnotAZ[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIKnotAX[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIKnotAX[m] = 1;
|
||
}
|
||
curve.m_ProjIKnotAZ[m] = curve.m_ProjIKnotAX[m] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Z")
|
||
{
|
||
curve.m_ProjIKnotAZ[m] = 0;
|
||
curve.m_ProjIKnotAX[m] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIKnotAY[m] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIKnotAY[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIKnotAX[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIKnotAX[m] = 1;
|
||
}
|
||
curve.m_ProjIKnotAY[m] = curve.m_ProjIKnotAX[m] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
}
|
||
|
||
void CurveInterpreter::SetProjIIKnotAXYZ(Curve_M& curve, int m, const std::string& dir, double ang)
|
||
{
|
||
// 将 ang 归到 0~360 之间
|
||
ang = fmod(ang, 360.0);
|
||
if (ang < 0) ang = 360 + ang;
|
||
|
||
if (dir == "X")
|
||
{
|
||
curve.m_ProjIIKnotAX[m] = 0;
|
||
curve.m_ProjIIKnotAY[m] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIIKnotAZ[m] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIIKnotAZ[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIIKnotAY[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIIKnotAY[m] = 1;
|
||
}
|
||
curve.m_ProjIIKnotAZ[m] = curve.m_ProjIIKnotAY[m] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Y")
|
||
{
|
||
curve.m_ProjIIKnotAY[m] = 0;
|
||
curve.m_ProjIIKnotAX[m] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIIKnotAZ[m] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIIKnotAZ[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIIKnotAX[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIIKnotAX[m] = 1;
|
||
}
|
||
curve.m_ProjIIKnotAZ[m] = curve.m_ProjIIKnotAX[m] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
else if (dir == "Z")
|
||
{
|
||
curve.m_ProjIIKnotAZ[m] = 0;
|
||
curve.m_ProjIIKnotAX[m] = 0;
|
||
if (ang == 90)
|
||
{
|
||
curve.m_ProjIIKnotAY[m] = 1;
|
||
}
|
||
else if (ang == 270)
|
||
{
|
||
curve.m_ProjIIKnotAY[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
if (ang > 90 && ang < 270)
|
||
{
|
||
curve.m_ProjIIKnotAX[m] = -1;
|
||
}
|
||
else
|
||
{
|
||
curve.m_ProjIIKnotAX[m] = 1;
|
||
}
|
||
curve.m_ProjIIKnotAY[m] = curve.m_ProjIIKnotAX[m] * tan(ang / 180.0 * M_PI);
|
||
}
|
||
}
|
||
}
|
||
|
||
void CurveInterpreter::addPointIfNotExists(std::vector<Point3D_M>& points, const Point3D_M& p) {
|
||
if (std::find(points.begin(), points.end(), p) == points.end()) {
|
||
points.push_back(p);
|
||
}
|
||
} |