Diff
checker
文本
文本
图像
文档
Excel
文件夹
Legal
Enterprise
桌面版
定价
登录
下载 Diffchecker 桌面版
比较文本
查找两个文本文件之间的差异
工具
历史
实时编辑器
折叠未更改行
关闭换行
视图
拆分
统一
比对精度
智能
单词
字符
语法高亮
选择语法
忽略
文本转换
转到第一个差异
编辑输入
Diffchecker Desktop
运行Diffchecker最安全的方式。获取Diffchecker桌面应用:您的差异永远不会离开您的电脑!
获取桌面版
Subdivision Step Sampler diff 5.8 / 5.7
创建于
19小时前
差异永不过期
清除
导出
分享
解释
0 删除
行
总计
删除
字符
总计
删除
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
87 行
全部复制
3 添加
行
总计
添加
字符
总计
添加
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
87 行
全部复制
virtual void Step(FSamplerResult& OutResult) override
virtual void Step(FSamplerResult& OutResult) override
{
{
const int PreviousSegmentIndex = (CurrentSegmentIndex > 0 ? CurrentSegmentIndex : NumSegments) - 1;
const int PreviousSegmentIndex = (CurrentSegmentIndex > 0 ? CurrentSegmentIndex : NumSegments) - 1;
// To capture the last key point on the spline, we sample the point at the end of the previous segment.
// To capture the last key point on the spline, we sample the point at the end of the previous segment.
const bool bLastKeyPoint = CurrentSegmentIndex == LineData->GetNumSegments();
const bool bLastKeyPoint = CurrentSegmentIndex == LineData->GetNumSegments();
const int SegmentIndex = bLastKeyPoint ? PreviousSegmentIndex : CurrentSegmentIndex;
const int SegmentIndex = bLastKeyPoint ? PreviousSegmentIndex : CurrentSegmentIndex;
const FVector::FReal SegmentLength = LineData->GetSegmentLength(SegmentIndex);
const FVector::FReal SegmentLength = LineData->GetSegmentLength(SegmentIndex);
const FVector::FReal SegmentStep = SegmentLength / (SubdivisionsPerSegment + 1);
const FVector::FReal SegmentStep = SegmentLength / (SubdivisionsPerSegment + 1);
const FVector::FReal DistanceAlongSegment = bLastKeyPoint ? SegmentLength : SubpointIndex * SegmentStep;
const FVector::FReal DistanceAlongSegment = bLastKeyPoint ? SegmentLength : SubpointIndex * SegmentStep;
FBox& OutBox = OutResult.Box;
FBox& OutBox = OutResult.Box;
FTransform& OutTransform = OutResult.LocalTransform;
FTransform& OutTransform = OutResult.LocalTransform;
OutTransform = LineData->GetTransformAtDistance(SegmentIndex, DistanceAlongSegment, /*bWorldSpace=*/false, &OutBox);
OutTransform = LineData->GetTransformAtDistance(SegmentIndex, DistanceAlongSegment, /*bWorldSpace=*/false, &OutBox);
OutResult.SampleIndex = SampleIndex++;
OutResult.SampleIndex = SampleIndex++;
OutResult.SegmentIndex = LineData->IsClosed() ? CurrentSegmentIndex : SegmentIndex;
OutResult.SegmentIndex = LineData->IsClosed() ? CurrentSegmentIndex : SegmentIndex;
OutResult.SubsegmentIndex = SubpointIndex;
OutResult.SubsegmentIndex = SubpointIndex;
OutResult.InputKey = LineData->GetInputKeyAtDistance(SegmentIndex, DistanceAlongSegment);
OutResult.InputKey = LineData->GetInputKeyAtDistance(SegmentIndex, DistanceAlongSegment);
if (bComputeCurvature)
if (bComputeCurvature)
{
{
OutResult.Curvature = LineData->GetCurvatureAtDistance(SegmentIndex, DistanceAlongSegment);
OutResult.Curvature = LineData->GetCurvatureAtDistance(SegmentIndex, DistanceAlongSegment);
}
}
if (bComputeTangents)
if (bComputeTangents)
{
{
// Control points have actual Arrive and Leave tangents
// Control points have actual Arrive and Leave tangents
if (SubpointIndex == 0)
if (SubpointIndex == 0)
{
{
LineData->GetTangentsAtSegmentStart(CurrentSegmentIndex, OutResult.ArriveTangent, OutResult.LeaveTangent);
LineData->GetTangentsAtSegmentStart(CurrentSegmentIndex, OutResult.ArriveTangent, OutResult.LeaveTangent);
}
}
else
else
{
{
// For a non-control-point, we can get the normalized tangent at least.
// For a non-control-point, we can get the normalized tangent at least.
const FVector Forward = OutTransform.GetRotation().GetForwardVector();
const FVector Forward = OutTransform.GetRotation().GetForwardVector();
OutResult.ArriveTangent = Forward;
OutResult.ArriveTangent = Forward;
OutResult.LeaveTangent = Forward;
OutResult.LeaveTangent = Forward;
}
}
}
}
if (bComputeAlpha)
if (bComputeAlpha)
{
{
OutResult.Alpha = LineData->GetAlphaAtDistance(SegmentIndex, DistanceAlongSegment);
OutResult.Alpha = LineData->GetAlphaAtDistance(SegmentIndex, DistanceAlongSegment);
}
}
if (bComputeDistance)
if (bComputeDistance)
{
{
// When we step onto a new segment, add the length of the previous segment onto the distance to our current segment.
// When we step onto a new segment, add the length of the previous segment onto the distance to our current segment.
if (SegmentIndex > 0 && !bLastKeyPoint && SubpointIndex == 0)
if (SegmentIndex > 0 && !bLastKeyPoint && SubpointIndex == 0)
{
{
DistanceToCurrentSegment += LineData->GetSegmentLength(SegmentIndex - 1);
DistanceToCurrentSegment += LineData->GetSegmentLength(SegmentIndex - 1);
}
}
OutResult.Distance = DistanceToCurrentSegment + DistanceAlongSegment;
OutResult.Distance = DistanceToCurrentSegment + DistanceAlongSegment;
}
}
const double ScaleFactor = 0.5 * SegmentStep / (FMath::IsNearlyZero(OutTransform.GetScale3D().X) ? UE_DOUBLE_SMALL_NUMBER : OutTransform.GetScale3D().X);
const double ScaleFactor = 0.5 * SegmentStep / (FMath::IsNearlyZero(OutTransform.GetScale3D().X) ? UE_DOUBLE_SMALL_NUMBER : OutTransform.GetScale3D().X);
if (SubpointIndex == 0)
if (SubpointIndex == 0)
{
{
const FVector::FReal PreviousSegmentLength = LineData->GetSegmentLength(PreviousSegmentIndex);
const FVector::FReal PreviousSegmentLength = LineData->GetSegmentLength(PreviousSegmentIndex);
FTransform PreviousSegmentEndTransform = LineData->GetTransformAtDistance(PreviousSegmentIndex, PreviousSegmentLength, /*bWorldSpace=*/false);
FTransform PreviousSegmentEndTransform = LineData->GetTransformAtDistance(PreviousSegmentIndex, PreviousSegmentLength, /*bWorldSpace=*/false);
if ((PreviousSegmentEndTransform.GetLocation() - OutTransform.GetLocation()).Length() <= KINDA_SMALL_NUMBER)
if ((PreviousSegmentEndTransform.GetLocation() - OutTransform.GetLocation()).Length() <= KINDA_SMALL_NUMBER)
{
{
OutBox.Min.X *= 0.5 * PreviousSegmentLength / ((FMath::IsNearlyZero(PreviousSegmentEndTransform.GetScale3D().X) ? UE_DOUBLE_SMALL_NUMBER : PreviousSegmentEndTransform.GetScale3D().X) * (SubdivisionsPerSegment + 1));
OutBox.Min.X *= 0.5 * PreviousSegmentLength / ((FMath::IsNearlyZero(PreviousSegmentEndTransform.GetScale3D().X) ? UE_DOUBLE_SMALL_NUMBER : PreviousSegmentEndTransform.GetScale3D().X) * (SubdivisionsPerSegment + 1));
}
}
else
else
{
{
复制
已复制
复制
已复制
OutBox.Min.X *=
ScaleFactor;
OutBox.Min.X *=
0.5 * SegmentStep /
ScaleFactor;
}
}
}
}
else
else
{
{
复制
已复制
复制
已复制
OutBox.Min.X *=
ScaleFactor;
OutBox.Min.X *=
0.5 * SegmentStep /
ScaleFactor;
}
}
复制
已复制
复制
已复制
OutBox.Max.X *=
ScaleFactor;
OutBox.Max.X *=
0.5 * SegmentStep /
ScaleFactor;
++SubpointIndex;
++SubpointIndex;
if (SubpointIndex > SubdivisionsPerSegment || bLastKeyPoint)
if (SubpointIndex > SubdivisionsPerSegment || bLastKeyPoint)
{
{
SubpointIndex = 0;
SubpointIndex = 0;
++CurrentSegmentIndex;
++CurrentSegmentIndex;
}
}
}
}
已保存差异
原始文本
打开文件
virtual void Step(FSamplerResult& OutResult) override { const int PreviousSegmentIndex = (CurrentSegmentIndex > 0 ? CurrentSegmentIndex : NumSegments) - 1; // To capture the last key point on the spline, we sample the point at the end of the previous segment. const bool bLastKeyPoint = CurrentSegmentIndex == LineData->GetNumSegments(); const int SegmentIndex = bLastKeyPoint ? PreviousSegmentIndex : CurrentSegmentIndex; const FVector::FReal SegmentLength = LineData->GetSegmentLength(SegmentIndex); const FVector::FReal SegmentStep = SegmentLength / (SubdivisionsPerSegment + 1); const FVector::FReal DistanceAlongSegment = bLastKeyPoint ? SegmentLength : SubpointIndex * SegmentStep; FBox& OutBox = OutResult.Box; FTransform& OutTransform = OutResult.LocalTransform; OutTransform = LineData->GetTransformAtDistance(SegmentIndex, DistanceAlongSegment, /*bWorldSpace=*/false, &OutBox); OutResult.SampleIndex = SampleIndex++; OutResult.SegmentIndex = LineData->IsClosed() ? CurrentSegmentIndex : SegmentIndex; OutResult.SubsegmentIndex = SubpointIndex; OutResult.InputKey = LineData->GetInputKeyAtDistance(SegmentIndex, DistanceAlongSegment); if (bComputeCurvature) { OutResult.Curvature = LineData->GetCurvatureAtDistance(SegmentIndex, DistanceAlongSegment); } if (bComputeTangents) { // Control points have actual Arrive and Leave tangents if (SubpointIndex == 0) { LineData->GetTangentsAtSegmentStart(CurrentSegmentIndex, OutResult.ArriveTangent, OutResult.LeaveTangent); } else { // For a non-control-point, we can get the normalized tangent at least. const FVector Forward = OutTransform.GetRotation().GetForwardVector(); OutResult.ArriveTangent = Forward; OutResult.LeaveTangent = Forward; } } if (bComputeAlpha) { OutResult.Alpha = LineData->GetAlphaAtDistance(SegmentIndex, DistanceAlongSegment); } if (bComputeDistance) { // When we step onto a new segment, add the length of the previous segment onto the distance to our current segment. if (SegmentIndex > 0 && !bLastKeyPoint && SubpointIndex == 0) { DistanceToCurrentSegment += LineData->GetSegmentLength(SegmentIndex - 1); } OutResult.Distance = DistanceToCurrentSegment + DistanceAlongSegment; } const double ScaleFactor = 0.5 * SegmentStep / (FMath::IsNearlyZero(OutTransform.GetScale3D().X) ? UE_DOUBLE_SMALL_NUMBER : OutTransform.GetScale3D().X); if (SubpointIndex == 0) { const FVector::FReal PreviousSegmentLength = LineData->GetSegmentLength(PreviousSegmentIndex); FTransform PreviousSegmentEndTransform = LineData->GetTransformAtDistance(PreviousSegmentIndex, PreviousSegmentLength, /*bWorldSpace=*/false); if ((PreviousSegmentEndTransform.GetLocation() - OutTransform.GetLocation()).Length() <= KINDA_SMALL_NUMBER) { OutBox.Min.X *= 0.5 * PreviousSegmentLength / ((FMath::IsNearlyZero(PreviousSegmentEndTransform.GetScale3D().X) ? UE_DOUBLE_SMALL_NUMBER : PreviousSegmentEndTransform.GetScale3D().X) * (SubdivisionsPerSegment + 1)); } else { OutBox.Min.X *= ScaleFactor; } } else { OutBox.Min.X *= ScaleFactor; } OutBox.Max.X *= ScaleFactor; ++SubpointIndex; if (SubpointIndex > SubdivisionsPerSegment || bLastKeyPoint) { SubpointIndex = 0; ++CurrentSegmentIndex; } }
更改后文本
打开文件
virtual void Step(FSamplerResult& OutResult) override { const int PreviousSegmentIndex = (CurrentSegmentIndex > 0 ? CurrentSegmentIndex : NumSegments) - 1; // To capture the last key point on the spline, we sample the point at the end of the previous segment. const bool bLastKeyPoint = CurrentSegmentIndex == LineData->GetNumSegments(); const int SegmentIndex = bLastKeyPoint ? PreviousSegmentIndex : CurrentSegmentIndex; const FVector::FReal SegmentLength = LineData->GetSegmentLength(SegmentIndex); const FVector::FReal SegmentStep = SegmentLength / (SubdivisionsPerSegment + 1); const FVector::FReal DistanceAlongSegment = bLastKeyPoint ? SegmentLength : SubpointIndex * SegmentStep; FBox& OutBox = OutResult.Box; FTransform& OutTransform = OutResult.LocalTransform; OutTransform = LineData->GetTransformAtDistance(SegmentIndex, DistanceAlongSegment, /*bWorldSpace=*/false, &OutBox); OutResult.SampleIndex = SampleIndex++; OutResult.SegmentIndex = LineData->IsClosed() ? CurrentSegmentIndex : SegmentIndex; OutResult.SubsegmentIndex = SubpointIndex; OutResult.InputKey = LineData->GetInputKeyAtDistance(SegmentIndex, DistanceAlongSegment); if (bComputeCurvature) { OutResult.Curvature = LineData->GetCurvatureAtDistance(SegmentIndex, DistanceAlongSegment); } if (bComputeTangents) { // Control points have actual Arrive and Leave tangents if (SubpointIndex == 0) { LineData->GetTangentsAtSegmentStart(CurrentSegmentIndex, OutResult.ArriveTangent, OutResult.LeaveTangent); } else { // For a non-control-point, we can get the normalized tangent at least. const FVector Forward = OutTransform.GetRotation().GetForwardVector(); OutResult.ArriveTangent = Forward; OutResult.LeaveTangent = Forward; } } if (bComputeAlpha) { OutResult.Alpha = LineData->GetAlphaAtDistance(SegmentIndex, DistanceAlongSegment); } if (bComputeDistance) { // When we step onto a new segment, add the length of the previous segment onto the distance to our current segment. if (SegmentIndex > 0 && !bLastKeyPoint && SubpointIndex == 0) { DistanceToCurrentSegment += LineData->GetSegmentLength(SegmentIndex - 1); } OutResult.Distance = DistanceToCurrentSegment + DistanceAlongSegment; } const double ScaleFactor = 0.5 * SegmentStep / (FMath::IsNearlyZero(OutTransform.GetScale3D().X) ? UE_DOUBLE_SMALL_NUMBER : OutTransform.GetScale3D().X); if (SubpointIndex == 0) { const FVector::FReal PreviousSegmentLength = LineData->GetSegmentLength(PreviousSegmentIndex); FTransform PreviousSegmentEndTransform = LineData->GetTransformAtDistance(PreviousSegmentIndex, PreviousSegmentLength, /*bWorldSpace=*/false); if ((PreviousSegmentEndTransform.GetLocation() - OutTransform.GetLocation()).Length() <= KINDA_SMALL_NUMBER) { OutBox.Min.X *= 0.5 * PreviousSegmentLength / ((FMath::IsNearlyZero(PreviousSegmentEndTransform.GetScale3D().X) ? UE_DOUBLE_SMALL_NUMBER : PreviousSegmentEndTransform.GetScale3D().X) * (SubdivisionsPerSegment + 1)); } else { OutBox.Min.X *= 0.5 * SegmentStep / ScaleFactor; } } else { OutBox.Min.X *= 0.5 * SegmentStep / ScaleFactor; } OutBox.Max.X *= 0.5 * SegmentStep / ScaleFactor; ++SubpointIndex; if (SubpointIndex > SubdivisionsPerSegment || bLastKeyPoint) { SubpointIndex = 0; ++CurrentSegmentIndex; } }
查找差异