1
This commit is contained in:
@@ -5,37 +5,37 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// 插入点(DataInsertPoint) 转换 点(DataPoint)
|
||||
/// </summary>
|
||||
public class BuilderInsertPointToPoint : ModuleBuilder<DataInsertPoint, DataPoint> {
|
||||
//public class BuilderInsertPointToPoint : ModuleBuilder<DataInsertPoint, DataPoint> {
|
||||
|
||||
protected override void Awake() => ModuleCore.InsertPointToPoint = this;
|
||||
// protected override void Awake() => ModuleCore.InsertPointToPoint = this;
|
||||
|
||||
public override DataPoint To(DataInsertPoint insertPoint) {
|
||||
DataPlate plate = insertPoint.plate;
|
||||
Vector3 position = insertPoint.position;
|
||||
//创建新的点
|
||||
DataPoint point = new DataPoint(insertPoint.plate);
|
||||
point.position = position;
|
||||
//改变关联的边B点,重置贝塞尔曲线
|
||||
insertPoint.side.bPoint = point;
|
||||
insertPoint.side.OneRankBezier();
|
||||
//创建新的边
|
||||
DataSide side = CreateDataSide(plate, point, insertPoint.bPoint);
|
||||
//插入边
|
||||
int sideIndex = plate.sides.IndexOf(insertPoint.side);
|
||||
plate.sides.Insert(sideIndex + 1, side);
|
||||
//插入点
|
||||
int pointIndex = plate.points.IndexOf(insertPoint.aPoint);
|
||||
plate.points.Insert(pointIndex + 1, point);
|
||||
//更新数据
|
||||
plate.UpdateVisual();
|
||||
return point;
|
||||
}
|
||||
// public override DataPoint To(DataInsertPoint insertPoint) {
|
||||
// DataPlate plate = insertPoint.plate;
|
||||
// Vector3 position = insertPoint.position;
|
||||
// //创建新的点
|
||||
// DataPoint point = new DataPoint(insertPoint.plate);
|
||||
// point.position = position;
|
||||
// //改变关联的边B点,重置贝塞尔曲线
|
||||
// insertPoint.side.bPoint = point;
|
||||
// insertPoint.side.OneRankBezier();
|
||||
// //创建新的边
|
||||
// DataSide side = CreateDataSide(plate, point, insertPoint.bPoint);
|
||||
// //插入边
|
||||
// int sideIndex = plate.sides.IndexOf(insertPoint.side);
|
||||
// plate.sides.Insert(sideIndex + 1, side);
|
||||
// //插入点
|
||||
// int pointIndex = plate.points.IndexOf(insertPoint.aPoint);
|
||||
// plate.points.Insert(pointIndex + 1, point);
|
||||
// //更新数据
|
||||
// plate.UpdateVisual();
|
||||
// return point;
|
||||
// }
|
||||
|
||||
private DataSide CreateDataSide(DataPlate plate, DataPoint a, DataPoint b) {
|
||||
DataSide side = new DataSide(plate);
|
||||
side.aPoint = a;
|
||||
side.bPoint = b;
|
||||
side.OneRankBezier();
|
||||
return side;
|
||||
}
|
||||
}
|
||||
// private DataSide CreateDataSide(DataPlate plate, DataPoint a, DataPoint b) {
|
||||
// DataSide side = new DataSide(plate);
|
||||
// side.aPoint = a;
|
||||
// side.bPoint = b;
|
||||
// side.OneRankBezier();
|
||||
// return side;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -11,24 +11,24 @@ public class BuilderPlatePresetsToPlate : ModuleBuilder<DataPlatePresets, DataPl
|
||||
|
||||
public override DataPlate To(DataPlatePresets origin) {
|
||||
DataPlate dataPlate = new DataPlate();
|
||||
dataPlate.points = ToDataPoint(dataPlate, origin.designPoints);
|
||||
dataPlate.sides = ToDataSide(dataPlate, dataPlate.points);
|
||||
dataPlate.platePoints = ToDataPoint(dataPlate, origin.designPoints);
|
||||
dataPlate.plateSides = ToDataSide(dataPlate, dataPlate.platePoints);
|
||||
return dataPlate;
|
||||
}
|
||||
|
||||
private List<DataPoint> ToDataPoint(DataPlate dataPlate, List<Vector3> list) {
|
||||
List<DataPoint> points = new List<DataPoint>();
|
||||
private List<DataPlatePoint> ToDataPoint(DataPlate dataPlate, List<Vector3> list) {
|
||||
List<DataPlatePoint> points = new List<DataPlatePoint>();
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
DataPoint point = new DataPoint(dataPlate);
|
||||
DataPlatePoint point = new DataPlatePoint(dataPlate);
|
||||
point.position = list[i];
|
||||
points.Add(point);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
private List<DataSide> ToDataSide(DataPlate dataPlate, List<DataPoint> list) {
|
||||
List<DataSide> sides = new List<DataSide>();
|
||||
private List<DataPlateSide> ToDataSide(DataPlate dataPlate, List<DataPlatePoint> list) {
|
||||
List<DataPlateSide> sides = new List<DataPlateSide>();
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
DataSide side = new DataSide(dataPlate);
|
||||
DataPlateSide side = new DataPlateSide(dataPlate);
|
||||
side.aPoint = list.LoopIndex(i + 0);
|
||||
side.bPoint = list.LoopIndex(i + 1);
|
||||
side.OneRankBezier();
|
||||
|
||||
Reference in New Issue
Block a user