Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto77 committed Oct 16, 2020
1 parent cf3db4c commit 0f2eaae
Show file tree
Hide file tree
Showing 13 changed files with 5,441 additions and 5,787 deletions.
4 changes: 2 additions & 2 deletions Crystallography.Controls/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2020.10.15.0839")]
[assembly: AssemblyFileVersion("2020.10.15.0839")]
[assembly: AssemblyVersion("2020.10.16.0824")]
[assembly: AssemblyFileVersion("2020.10.16.0824")]
54 changes: 30 additions & 24 deletions Crystallography/Geometriy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -655,45 +655,51 @@ public static Vector3DBase GetCrossPoint(double a, double b, double c, double d,
/// <returns></returns>
public static PointD[][] GetPointsWithinRectangle(IEnumerable<PointD> sourcePoints, RectangleD area)
{
var pt = sourcePoints.ToList();
//まず、横軸の上限と下限をトリム
List<PointD> pt = new List<PointD>();
foreach (var p in sourcePoints)
pt.Add(p);
int first = pt.FindIndex(p => p.X >= area.X) - 1;
var first = pt.FindIndex(p => p.X >= area.X) - 1;
if (first > 0)
pt.RemoveRange(0, first);
int last = pt.FindLastIndex(p => p.X <= area.X + area.Width) + 2;
var last = pt.FindLastIndex(p => p.X <= area.X + area.Width) + 2;
if (last < pt.Count)
pt.RemoveRange(last, pt.Count - last);

for (int i = 0; i < pt.Count - 1; i++)
if (pt.Max(p => p.Y) <= area.UpperY && pt.Min(pt => pt.Y) >= area.Y)
return new[] { pt.ToArray() };
else if(pt.Max(p => p.Y) <= area.Y || pt.Min(pt => pt.Y) >= area.UpperY)
return new[] { new PointD[] { } };
else
{
if (!area.IsInsde(pt[i]) || !area.IsInsde(pt[i + 1])) //どちらかが範囲外の時

for (int i = 0; i < pt.Count - 1; i++)
{
var pts = getCrossPoint(pt[i], pt[i + 1], area);
if (pts != null)
if (!area.IsInsde(pt[i]) || !area.IsInsde(pt[i + 1])) //どちらかが範囲外の時
{
pt.InsertRange(i + 1, pts);
i += pts.Length;
var pts = getCrossPoint(pt[i], pt[i + 1], area);
if (pts != null)
{
pt.InsertRange(i + 1, pts);
i += pts.Length;
}
}
}
}

var results = new List<List<PointD>>();
for (int i = 0; i < pt.Count - 1; i++)
{
if (!area.IsInsde(pt[i]))
pt.RemoveAt(i--);
else
var results = new List<List<PointD>>();
for (int i = 0; i < pt.Count - 1; i++)
{
var pts = new List<PointD>();
for (; i < pt.Count && area.IsInsde(pt[i]); i++)
pts.Add(new PointD(pt[i]));
i--;
results.Add(pts);
if (!area.IsInsde(pt[i]))
pt.RemoveAt(i--);
else
{
var pts = new List<PointD>();
for (; i < pt.Count && area.IsInsde(pt[i]); i++)
pts.Add(new PointD(pt[i]));
i--;
results.Add(pts);
}
}
return results.Select(r => r.ToArray()).ToArray();
}
return results.Select(r => r.ToArray()).ToArray();
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Crystallography/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// 下にあるように、'*' を使って、すべての値を指定するか、
// ビルドおよびリビジョン番号を既定値にすることができます。

[assembly: AssemblyVersion("2020.10.15.0839")]
[assembly: AssemblyVersion("2020.10.16.0824")]

//
// アセンブリに署名するには、使用するキーを指定しなければなりません。
Expand Down Expand Up @@ -57,5 +57,5 @@
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: ComVisibleAttribute(true)]
[assembly: AssemblyFileVersion("2020.10.15.0839")]
[assembly: AssemblyFileVersion("2020.10.16.0824")]

120 changes: 60 additions & 60 deletions PDIndexer/FormCrystal.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0f2eaae

Please sign in to comment.