Skip to content
Snippets Groups Projects
Commit f462bcca authored by Marco Zimmer's avatar Marco Zimmer
Browse files

misc: just PointerGadeget snaps on tree-roof, used 'IsApproximatelyParallel'...

misc: just PointerGadeget snaps on tree-roof, used 'IsApproximatelyParallel' for RayFact Equivalency
parent bfafcd96
No related branches found
No related tags found
No related merge requests found
......@@ -141,7 +141,7 @@ SphereCollider:
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.4
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!33 &933372636075482527
MeshFilter:
......
......@@ -184,7 +184,7 @@ GameObject:
- component: {fileID: 3394522495515098203}
- component: {fileID: 3394522495515098196}
- component: {fileID: 7137147696081341476}
m_Layer: 0
m_Layer: 12
m_Name: AngleOuter
m_TagString: Untagged
m_Icon: {fileID: 0}
......@@ -310,7 +310,7 @@ GameObject:
- component: {fileID: 3394522496185282006}
- component: {fileID: 3394522496185282007}
- component: {fileID: 2270583313952035853}
m_Layer: 0
m_Layer: 12
m_Name: AngleInner
m_TagString: Untagged
m_Icon: {fileID: 0}
......@@ -431,9 +431,9 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 5781467132517744785}
m_Layer: 0
m_Layer: 12
m_Name: Angle
m_TagString: Untagged
m_TagString: Selectable
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......
......@@ -399,8 +399,7 @@ public override GameObject instantiateDisplay(GameObject prefab, Transform trans
protected override bool EquivalentWrapped(RayFact f1, RayFact f2)
{
// TODO! check for similar(float uncertanty!) Directions
if (f1.Dir != f2.Dir && f1.Dir != -f2.Dir)
if (!Math3d.IsApproximatelyParallel(f1.Dir, f2.Dir))
return false;
PointFact p1f1 = (PointFact)Facts[f1.Pid1];
......
......@@ -109,7 +109,7 @@ private bool FindEquivalent(Fact search, out Fact found)
}
private void WorkflowAdd(stepnote note)
// adds Workflow; updates meta struct; Invokes Events
// prunes & adds Workflow; updates meta struct; Invokes Events
{
PruneWorkflow();
......@@ -154,6 +154,13 @@ private void PruneWorkflow()
base.Remove(last.Id);
MetaInf.Remove(last.Id);
}
else
// update active status
{
meta inf = MetaInf[last.Id];
inf.active = !last.creation;
MetaInf[last.Id] = inf;
}
}
// prune Worklfow down to marker
......@@ -231,7 +238,7 @@ public bool Remove(int key, bool samestep = false)
// TODO: MMT: decide dependencies there (remember virtual deletions in Unity (un-redo)!)
// TODO? decrease runtime from O(n/2)
private bool safe_dependencies(int key, out List<int> dependencies)
public bool safe_dependencies(int key, out List<int> dependencies)
// searches for dependencies of a Fact; returns false if any dependencies are steproots
// int key: Fact to be deleted
// out List<int> dependencies: dependencyList
......
......@@ -534,7 +534,7 @@ public static bool IsPointOnLine(Vector3 linePoint, Vector3 lineVec, Vector3 poi
}
//This function returns true if a point is approximately on a line.
//The line is regarded infinite.
//The line is regarded as being infinite.
public static bool IsPointApproximatelyOnLine(Vector3 linePoint, Vector3 lineVec, Vector3 point, double precission = Math3d.vectorPrecission)
{
......@@ -543,7 +543,17 @@ public static bool IsPointApproximatelyOnLine(Vector3 linePoint, Vector3 lineVec
double t = Vector3.Dot(linePointToPoint.normalized, lineVec);
return Math.Abs(t - 1d) < precission || Math.Abs(t) < precission;
return Math.Abs(Math.Abs(t) - 1d) < precission || Math.Abs(t) < precission;
}
//This function returns true if two Vector3s are approximately parallel
public static bool IsApproximatelyParallel(Vector3 vectorA, Vector3 vectorB, double precission = Math3d.vectorPrecission)
{
//SqrMagnitude(Abs(vectorA) - Abs(vectorB)) < precission
return Math.Pow(Math.Abs(vectorA.x) - Math.Abs(vectorB.x), 2)
+ Math.Pow(Math.Abs(vectorA.y) - Math.Abs(vectorB.y), 2)
+ Math.Pow(Math.Abs(vectorA.z) - Math.Abs(vectorB.z), 2)
< precission;
}
//This function returns a point which is a projection from a point to a line segment.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment