6 using namespace entity;
9 const std::vector<geo::Coordinate>& controlPoints,
10 const std::vector<double>& knotPoints,
11 const std::vector<geo::Coordinate>& fitPoints,
12 int degree,
bool closed,
double fitTolerance,
13 double stanx,
double stany,
double stanz,
14 double etanx,
double etany,
double etanz,
15 double nx,
double ny,
double nz,
17 const Layer_CSPtr layer,
18 const MetaInfo_CSPtr metaInfo,
19 const Block_CSPtr block) :
38 other->controlPoints(),
43 other->fitTolerance(),
44 other->startTanX(), other->startTanY(), other->startTanZ(),
45 other->endTanX(), other->endTanY(), other->endTanZ(),
46 other->nX(), other->nY(), other->nZ(),
49 _boundingBox(other->boundingBox()) {
56 return std::vector<EntityCoordinate>();
67 std::vector<geo::Coordinate> control_pts;
70 control_pts.push_back(point + offset);
73 auto newSpline = std::make_shared<Spline>(control_pts,
knotPoints(),
fitPoints(),
degree(),
closed(),
fitTolerance(),
startTanX(),
startTanY(),
startTanZ(),
endTanX(),
endTanY(),
endTanZ(),
nX(),
nY(),
nZ(),
flags(),
layer(),
metaInfo());
74 newSpline->setID(this->
id());
79 std::vector<geo::Coordinate> control_pts;
82 control_pts.push_back(point + offset);
85 auto newSpline = std::make_shared<Spline>(control_pts,
knotPoints(),
fitPoints(),
degree(),
closed(),
fitTolerance(),
startTanX(),
startTanY(),
startTanZ(),
endTanX(),
endTanY(),
endTanZ(),
nX(),
nY(),
nZ(),
flags(),
layer(),
metaInfo());
90 std::vector<geo::Coordinate> control_pts;
93 control_pts.push_back(point.rotate(rotation_center, rotation_angle));
98 auto newSpline = std::make_shared<Spline>(control_pts,
knotPoints(),
fitPoints(),
degree(),
closed(),
fitTolerance(),
startTanX(),
startTanY(),
startTanZ(),
endTanX(),
endTanY(),
endTanZ(), normal.x(), normal.y(), normal.z(),
flags(),
layer(),
metaInfo());
99 newSpline->setID(this->
id());
104 std::vector<geo::Coordinate> control_pts;
107 control_pts.push_back(point.scale(scale_center, scale_factor));
110 auto newSpline = std::make_shared<Spline>(control_pts,
knotPoints(),
fitPoints(),
degree(),
closed(),
fitTolerance(),
startTanX(),
startTanY(),
startTanZ(),
endTanX(),
endTanY(),
endTanZ(),
nX(),
nY(),
nZ(),
flags(),
layer(),
metaInfo());
111 newSpline->setID(this->
id());
116 std::vector<geo::Coordinate> control_pts;
119 control_pts.push_back(point.mirror(axis1, axis2));
122 auto newSpline = std::make_shared<Spline>(control_pts,
knotPoints(),
fitPoints(),
degree(),
closed(),
fitTolerance(),
startTanX(),
startTanY(),
startTanZ(),
endTanX(),
endTanY(),
endTanZ(),
nX(),
nY(),
nZ(),
flags(),
layer(),
metaInfo());
123 newSpline->setID(this->
id());
131 CADEntity_CSPtr
Spline::modify(Layer_CSPtr layer,
const MetaInfo_CSPtr metaInfo, Block_CSPtr block)
const {
132 auto newSpline = std::make_shared<Spline>(
146 newSpline->setID(
id());
162 std::map<unsigned int, lc::geo::Coordinate> dragpoints;
167 dragpoints[i] = point;
172 dragpoints[i] = point;
182 std::vector<lc::geo::Coordinate>
fitPoints;
187 for(
unsigned int j = 0; j < this->
fitPoints().size(); j++) {
188 fitPoints.push_back(dragPoints.at(i));
192 for(
unsigned int j = 0; j < this->
controlPoints().size(); j++) {
193 controlPoints.push_back(dragPoints.at(i));
210 newEntity->setID(
id());
214 catch(
const std::out_of_range& e) {
215 return shared_from_this();
virtual CADEntity_CSPtr mirror(const geo::Coordinate &axis1, const geo::Coordinate &axis2) const override
virtual CADEntity_CSPtr move(const geo::Coordinate &offset) const override
move, moves by an offset
short degree() const
degree, Returns degree of spline
double fitTolerance() const
Returns the fit point tolerance of the spline.
Layer_CSPtr layer() const
layer return the layer this entity is placed on
virtual std::map< unsigned int, lc::geo::Coordinate > dragPoints() const override
Get all points of the entity that can be dragged.
bool closed() const
closed, returns if spline is closed or not
Area merge(const Area &other) const
merge two area's and expand if required to largest containing area
MetaInfo_CSPtr metaInfo() const
void calculateBoundingBox()
Coordinate rotate(const Coordinate &angleVector) const
rotate around (0.,0.) with a given angle vector
virtual CADEntity_CSPtr copy(const geo::Coordinate &offset) const override
copy, copies line by an offset
virtual geo::Coordinate nearestPointOnPath(const geo::Coordinate &coord) const override
Find the nearest point on the path for this entity for the coordinate coord The path of a entity that...
Block_CSPtr block() const
Return the current entity block.
const std::vector< double > & knotPoints() const
Return a vector of knotpoints.
virtual std::vector< EntityCoordinate > snapPoints(const geo::Coordinate &coord, const SimpleSnapConstrain &constrain, double minDistanceToSnap, int maxNumberOfSnapPoints) const override
Find a number of snap points the line has available This function returns a ordered list...
const std::vector< Coordinate > & fitPoints() const
Return a vector of fitpoints.
virtual CADEntity_CSPtr rotate(const geo::Coordinate &rotation_center, const double rotation_angle) const override
rotate, rotate operation
Spline(const std::vector< geo::Coordinate > &controlPoints, const std::vector< double > &knotPoints, const std::vector< geo::Coordinate > &fitPoints, int degree, bool closed, double fitTolerance, double stanx, double stany, double stanz, double etanx, double etany, double etanz, double nx, double ny, double nz, splineflag flags, const Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo=nullptr, const Block_CSPtr block=nullptr)
Spline, Constructor with MetaTypes.
const std::vector< Coordinate > & controlPoints() const
control_points, Returns Control points of spline
virtual CADEntity_CSPtr setDragPoints(std::map< unsigned int, lc::geo::Coordinate > dragPoints) const override
Return modified entity.
virtual CADEntity_CSPtr modify(Layer_CSPtr layer, const MetaInfo_CSPtr metaInfo, Block_CSPtr block) const override
modify Return a new entity with the same ID bit with possible modified metainfo and/pr layer informat...
virtual const geo::Area boundingBox() const override
boundingBox of the entity
virtual CADEntity_CSPtr scale(const geo::Coordinate &scale_center, const geo::Coordinate &scale_factor) const override
scale, scales the entity