forked from Dan-Piker/K2Goals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTargetPlane.cs
38 lines (34 loc) · 912 Bytes
/
TargetPlane.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rhino.Geometry;
namespace KangarooSolver.Goals
{
/// <summary>
/// Keep point on a given plane
/// </summary>
public class TargetPlane : GoalObject
{
public double Strength;
public Plane _plane;
public TargetPlane()
{
}
public TargetPlane(int P, double k, Plane Target)
{
PIndex = new int[1] { P };
Move = new Vector3d[1];
Weighting = new double[1];
Strength = k;
_plane = Target;
}
public override void Calculate(List<KangarooSolver.Particle> p)
{
Point3d ThisPt = p[PIndex[0]].Position;
Move[0] = _plane.ClosestPoint(ThisPt) - ThisPt;
Weighting[0] = Strength;
}
}
}