This commit is contained in:
h z
2024-06-26 14:23:02 +08:00
parent cbe5887f5f
commit b8af5f3ccd
22 changed files with 467 additions and 174 deletions

25
Scenes/SelfBond.cs Normal file
View File

@@ -0,0 +1,25 @@
using System.Collections.Generic;
using Godot;
using VirtualChemDemo.Concepts;
namespace VirtualChemDemo.Scenes;
public partial class SelfBond : Bond2D
{
public override void BondUpdate()
{
Reindex();
List<Vector2> points = new();
Vector2 pcenter = new(30, 0);
pcenter = pcenter.Rotated((float)Index * Mathf.Pi * 2f / (float)Multi);
Vector2 center = AtomFrom.Position + new Vector2(32, 32) + pcenter;
Vector2 d = AtomFrom.Position + new Vector2(32, 32) - center;
for (int i = 0; i <= 24; i++)
points.Add(center + d.Rotated(i*Mathf.Pi*2/24));
BondTypeA.Position = points[12] + new Vector2(-20, 0);
BondTypeB.Position = points[12] + new Vector2(20, 0);
Points = points.ToArray();
BondTypeA.Text = BondFrom.BondType;
BondTypeB.Text = BondTo.BondType;
}
}