mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-03 01:12:42 +08:00
5410a48a58
Co-authored-by: bofeng.song <bofeng.song@chukong-inc.com> Co-authored-by: dumganhar <dumganhar@gmail.com> Co-authored-by: mmyduckx <308303735@qq.com> Co-authored-by: Patrice Jiang <397136899@qq.com> Co-authored-by: 江战 <40414978+PatriceJiang@users.noreply.github.com>
57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
#include "core/geometry/Line.h"
|
|
|
|
namespace cc {
|
|
namespace geometry {
|
|
|
|
Line *Line::create(float sx,
|
|
float sy,
|
|
float sz,
|
|
float ex,
|
|
float ey,
|
|
float ez) {
|
|
return new Line(sx, sy, sz, ex, ey, ez);
|
|
}
|
|
|
|
Line *Line::clone(const Line &a) {
|
|
return new Line(
|
|
a.s.x, a.s.y, a.s.z,
|
|
a.e.x, a.e.y, a.e.z);
|
|
}
|
|
|
|
Line *Line::copy(Line *out, const Line &a) {
|
|
out->s = a.s;
|
|
out->e = a.e;
|
|
return out;
|
|
}
|
|
|
|
Line *Line::fromPoints(Line *out, const Vec3 &start, const Vec3 &end) {
|
|
out->s = start;
|
|
out->e = end;
|
|
return out;
|
|
}
|
|
|
|
Line *Line::set(Line *out,
|
|
float sx,
|
|
float sy,
|
|
float sz,
|
|
float ex,
|
|
float ey,
|
|
float ez) {
|
|
out->s.x = sx;
|
|
out->s.y = sy;
|
|
out->s.z = sz;
|
|
out->e.x = ex;
|
|
out->e.y = ey;
|
|
out->e.z = ez;
|
|
|
|
return out;
|
|
}
|
|
|
|
Line::Line(float sx, float sy, float sz, float ex, float ey, float ez) {
|
|
setType(ShapeEnum::SHAPE_LINE);
|
|
s = {sx, sy, sz};
|
|
e = {ex, ey, ez};
|
|
}
|
|
|
|
} // namespace geometry
|
|
} // namespace cc
|