Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto77 committed Jun 23, 2022
1 parent f0b76e5 commit 1c5f5fc
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 63 deletions.
4 changes: 2 additions & 2 deletions Crystallography.Controls/Crystallography.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2022.06.21.1618</AssemblyVersion>
<FileVersion>2022.06.21.1618</FileVersion>
<AssemblyVersion>2022.06.23.1215</AssemblyVersion>
<FileVersion>2022.06.23.1215</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.OpenGL/Crystallography.OpenGL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2022.06.21.1618</AssemblyVersion>
<FileVersion>2022.06.21.1618</FileVersion>
<AssemblyVersion>2022.06.23.1215</AssemblyVersion>
<FileVersion>2022.06.23.1215</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
1 change: 0 additions & 1 deletion Crystallography.OpenGL/GLObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,6 @@ public static void DisableAllClips()
#endregion

#region 線分

public class Lines : GLObject
{
public Lines(V3d[] vertices, float lineWidth, Material mat) : base(mat, DrawingMode.Edges)
Expand Down
4 changes: 2 additions & 2 deletions Crystallography/Crystallography.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2022.06.21.1618</AssemblyVersion>
<FileVersion>2022.06.21.1618</FileVersion>
<AssemblyVersion>2022.06.23.1215</AssemblyVersion>
<FileVersion>2022.06.23.1215</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
4 changes: 2 additions & 2 deletions Crystallography/Symmetry/Symmetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static List<Func<int, int, int, string>> SetExtinctionFunc(Symmetry sym)
func.Add((h, k, l) => (h + k + l) % 2 != 0 ? "I" : null);
else if (sym.LatticeTypeStr == "F")
func.Add((h, k, l) => ((h + k) % 2 != 0 || (k + l) % 2 != 0 || (l + h) % 2 != 0) ? "F" : null);
else if (sym.LatticeTypeStr == "R")
else if (sym.LatticeTypeStr == "R" && sym.SpaceGroupHMStr.Contains("Hex"))
func.Add((h, k, l) => (-h + k + l) % 3 != 0 ? "R" : null);

switch (sym.CrystalSystemNumber)
Expand Down Expand Up @@ -493,7 +493,7 @@ public static string[] ExtinctionRule(Symmetry sym)
"C" => "hkl: h+k=2n: C",
"I" => "hkl: h+k+l=2n: I",
"F" => "hkl: h+k=2n k+l=2n: F",
"R" => "hkl: -h+k+l=3n: R",
"R" => sym.SpaceGroupHMStr.Contains("Hex") ? "hkl: -h+k+l=3n: R": "",
_ => ""
});
}
Expand Down
59 changes: 15 additions & 44 deletions Crystallography/Symmetry/SymmetryStatic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13126,20 +13126,12 @@ public static bool IsRootIndex((int h, int k, int l) index, Symmetry sym, ref Li
break;

case 2:// 2/m
switch (sym.MainAxis)
result = sym.MainAxis switch
{
case "a":
result = h >= 0 && (k > 0 || (k == 0 && l >= 0));
break;

case "b":
result = (k >= 0 && (h > 0 || (h == 0 && l >= 0)));
break;

case "c":
result = (l >= 0 && (h > 0 || (h == 0 && k >= 0)));
break;
}
"a" => h >= 0 && (k > 0 || (k == 0 && l >= 0)),
"b" => (k >= 0 && (h > 0 || (h == 0 && l >= 0))),
_ => (l >= 0 && (h > 0 || (h == 0 && k >= 0)))
};
break;

case 3:// mmm
Expand All @@ -13155,42 +13147,21 @@ public static bool IsRootIndex((int h, int k, int l) index, Symmetry sym, ref Li
break;

case 6: //-3
if (sym.SpaceGroupHMsubStr != "R")//Hexaセルの場合
{
result = ((h >= 0 && k >= 0 && (!(h == 0 && k == 0))) || (l > 0 && h == 0 && k == 0));
break;
}
else
{//Rhomboセルの場合
result = (h > 0 && k == 0 && l == 0) //2つが0のとき
|| (h > 0 && k != 0 && l == 0) //1つが0のとき
|| (h > 0 && k > 0 && l < 0) //1つが負のとき
|| (h > 0 && k > 0 && l > 0 && h >= k && h >= l && h != k && k != l && l != h) //全部正で、全部が異なるとき
|| (h > 0 && k > 0 && l > 0 && h >= k && h >= l && h == k && k > l) //全部正で、2つが同じとき①
|| (h > 0 && k > 0 && l > 0 && h >= k && h >= l && h > k && k == l) //全部正で、2つが同じとき①
|| (h > 0 && k > 0 && l > 0 && h == k && h == l); //全部正で、3つが同じとき

break;
}
if (sym.SpaceGroupHMsubStr != "R" )//Hexaセルの場合
result = (h == 0 && k == 0 && l > 0) || (h > 0 && k >= 0);
else//Rhomboセルの場合
result = (h > 0 && l == 0) || (h > 0 && k > 0 && l < 0) || (h >= k && k >= l && l > 0) || (h > l && l > k && k > 0);
break;

case 7: //-3m1
if (sym.SpaceGroupHMsubStr != "R")//Hexaセルの場合
{
result = ((l > 0 && h >= 0 && k >= 0) || (l == 0 && h <= k && h >= 0));
break;
}
else
{//Rhomboセルの場合
result = (h > 0 && k == 0 && l == 0)
|| (h > 0 && Math.Abs(h) >= Math.Abs(k) && k != 0 && l == 0)
|| (h >= k && k >= l && h > 0 && k > 0 && l != 0)
;
break;
}
result = ((l > 0 && h >= 0 && k >= 0) || (l == 0 && h >= k && k >= 0));
else//Rhomboセルの場合
result = (h > 0 && h >= Math.Abs(k) && l == 0) || (h >= k && k >= l && k > 0 && l != 0);
break;

case 8://6/m
result = (l >= 0 && h > 0 && k >= 0)
|| (l > 0 && h == 0 && k == 0);
result = (l >= 0 && h > 0 && k >= 0) || (l > 0 && h == 0 && k == 0);
break;

case 9://6/mmm
Expand Down
14 changes: 6 additions & 8 deletions ReciPro/FormStereonet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Crystallography.OpenGL;
using MathNet.Numerics;
using Microsoft.Win32;
using OpenTK;
using System;
using System.Collections.Generic;
using System.Drawing;
Expand Down Expand Up @@ -152,8 +153,7 @@ private void Draw3D()
V3 conv(double x, double y, double z) => radioButtonWulff.Checked ? new V3(x, y, 0) / (1 + z) : new V3(x, y, 0) / Math.Sqrt(1 + z) * sq2 + new V3(0, 0, 1);

List<GLObject> glObjects = new List<GLObject>();
glControl.DepthCueing = (true, (trackBarDepthFadingOut.Value-10)/2.0, 2);

glControl.DepthCueing = (true, (trackBarDepthFadingOut.Value - 10) / 2.0, 2);
Color color10 = colorControl10DegLine.Color, color90 = colorControl90DegLine.Color;

#region 球のアウトライン
Expand Down Expand Up @@ -194,7 +194,6 @@ private void Draw3D()
glObjects.Add(new Lines(new V3[] { new V3(-sq2, 0, 1.005), new V3(sq2, 0, 1.005) }, 3f, new Material(color90)));
glObjects.Add(new Lines(new V3[] { new V3(0, -sq2, 1.005), new V3(0, sq2, 1.005) }, 3f, new Material(color90)));
glObjects.Add(new Disk(new V3(0, 0, 1), new V3(0, 0, 1), Math.Sqrt(2), 3f, new Material(color90), DrawingMode.Edges, 60));

}

for (int i = 10; i < 90; i += 10)
Expand Down Expand Up @@ -225,22 +224,22 @@ private void Draw3D()
var unique = radioButtonAxes.Checked ? colorControlUniqueAxis.Color : colorControlUniquePlane.Color;
var general = radioButtonAxes.Checked ? colorControlGeneralAxis.Color : colorControlGeneralPlane.Color;
var vector = radioButtonAxes.Checked ? formMain.Crystal.VectorOfAxis.ToArray() : formMain.Crystal.VectorOfPlane.ToArray();
var radius = pointSize*0.004;
var radius = pointSize * 0.004;
for (int i = 0; i < vector.Length; i++)
{
var v = formMain.Crystal.RotationMatrix * vector[i].Normarize();
var color = i < 6 && radioButtonRange.Checked ? unique : general;
if (!checkBox3dOptionSemisphere.Checked || v.Z > 0)
{
{
glObjects.Add(new Sphere(v, radius, new Material(color, 1), DrawingMode.Surfaces));
if (checkBox3dOptionLabel.Checked)
glObjects.Add(new TextObject(vector[i].Text, trackBarStrSize.Value / 8, v, radius +0.001, true, new Material(color)));
glObjects.Add(new TextObject(vector[i].Text, trackBarStrSize.Value / 8, v, radius + 0.001, true, new Material(color)));
}
if (checkBox3dOptionStereonet.Checked && v.Z > 0)
{
glObjects.Add(new Disk(conv(v.X, v.Y, v.Z) + new V3(0, 0, 0.0005), new V3(0, 0, 1), radius, new Material(color, 0.9), DrawingMode.Surfaces));
glObjects.Add(new Disk(conv(v.X, v.Y, v.Z) - new V3(0, 0, 0.0005), new V3(0, 0, 1), radius, new Material(color, 0.9), DrawingMode.Surfaces));

//projection line
if (checkBox3dOptionProjectionLine.Checked)
{
Expand All @@ -265,7 +264,6 @@ private void Draw3D()
glControl.DeleteAllObjects();
glControl.AddObjects(glObjects);
glControl.Refresh();

}

private readonly List<double> sin = new();
Expand Down
4 changes: 2 additions & 2 deletions ReciPro/ReciPro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2022.06.21.1618</AssemblyVersion>
<FileVersion>2022.06.21.1618</FileVersion>
<AssemblyVersion>2022.06.23.1215</AssemblyVersion>
<FileVersion>2022.06.23.1215</FileVersion>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<ApplicationIcon>App.ico</ApplicationIcon>
Expand Down

0 comments on commit 1c5f5fc

Please sign in to comment.