private void PostConstruct() { children[0] = field; IPositionObject p = field; p.Position = this; for (int i = 0; i < names.Length; i++) { ln.Add(names[i]); dn[names[i]] = i; } transform = InerialAcceleration; Measurement[] ma = new Measurement[] { new Measurement(getAx, ""), new Measurement(getAy, ""), new Measurement(getAz, "") }; MeasurementDerivation[] md = new MeasurementDerivation[] { new MeasurementDerivation(a, getVx, ma[0], "Vx"), new MeasurementDerivation(a, getVy, ma[1], "Vy"), new MeasurementDerivation(a, getVz, ma[2], "Vz") }; MeasurementDerivation[] mc = new MeasurementDerivation[] { new MeasurementDerivation(a, getX, md[0], "X"), new MeasurementDerivation(a, getY, md[1], "Y"), new MeasurementDerivation(a, getZ, md[2], "Z") }; for (int i = 0; i < 3; i++) { measures[i] = mc[i]; measures[i + 3] = md[i]; } }
public AreaTrigger(Vector3 areaPosition, float dimX, float dimY, float dimZ, IPositionObject trackedObject) : base() { DimX = dimX; DimY = dimY; DimZ = dimZ; Position = areaPosition; TrackedObject = trackedObject; Condition = delegate() { return( trackedObject.Position.X > Position.X - 1 / 2 * DimX && trackedObject.Position.X < Position.X + 1 / 2 * DimX && trackedObject.Position.Y > Position.Y - 1 / 2 * DimY && trackedObject.Position.Y < Position.Y + 1 / 2 * DimY && trackedObject.Position.Z > Position.Z - 1 / 2 * DimZ && trackedObject.Position.Z < Position.Z + 1 / 2 * DimZ ); }; }
/// <summary> /// Creates object the corresponds to button /// </summary> /// <param name="button">The button</param> /// <returns>Created object</returns> public override ICategoryObject CreateObject(IPaletteButton button) { string kind = button.Kind; // Kind of the object Type type = button.ReflectionType; if (type.IsSubclassOf(typeof(Camera))) { return(factory.NewCamera()); } if (type.Equals(typeof(Motion6D.SerializablePosition))) { object ob = factory.CreateObject(kind); // Usage of the kind if (ob != null) { SerializablePosition pos = new SerializablePosition(); pos.Parameters = ob; if (ob is IPositionObject) { IPositionObject po = ob as IPositionObject; po.Position = pos; } return(pos); } } return(null); }
void IMeasurements.UpdateMeasurements() { if (isUpdated) { return; } isUpdated = true; ReferenceFrame frame = position.GetParentFrame(); foreach (IPhysicalField field in fields) { IPositionObject po = field as IPositionObject; IPosition p = po.Position; ReferenceFrame ff = po.Position.GetParentFrame(); ReferenceFrame.GetRelativeFrame(ff, frame, relative); double[] r = relative.Position; double[,] m = relative.Matrix; object[] o = null; try { o = field[r]; fieldValue[field] = o; } catch (Exception ex) { ex.ShowError(10); o = GetFieldValue(field); } /* if (updatedFields[field]) * { * o = fieldValue[field]; * } * else * { * o = field[r]; * updatedFields[field] = true; * fieldValue[field] = o; * }*/ IList <object> res = results[field]; IList <ProcessField> pr = proc[field]; for (int i = 0; i < o.Length; i++) { object result = res[i]; ProcessField process = pr[i]; process(o[i], m, result); } } isUpdated = true; /*foreach (IPhysicalField field in fields) * { * updatedFields[field] = false; * }*/ }
public PositionXReachedTrigger(IPositionObject trackedObject, float PositionX) : base() { Position = new Vector3(PositionX, 0, 0); TrackedObject = trackedObject; Condition = delegate() { return(TrackedObject.Position.X > Position.X); }; }
public void Setup(IPositionObject target, Vector3[] points, float interval, BezierType type, System.Action <GameObject> onComplete) { this.bezierType = type; this.points = points; this.onComplete = onComplete; this.target = target; this.interval = interval; this.timer = 0f; target.SetPosition(points[0]); this.isStarted = true; }
void SetObject() { object o = Parameters; if (o == null) { return; } if (o is IPositionObject) { IPositionObject po = o as IPositionObject; po.Position = this; } }
void IFieldConsumer.Add(IPhysicalField field) { if (this.field != null) { throw new Exception("Field of this object already exist"); } if (!(field is IPositionObject)) { throw new Exception("Field has no postion"); } this.field = field; IPositionObject po = field as IPositionObject; fieldFrame = ReferenceFrame.GetOwnFrame(po.Position); CreateDelegate(); }
public static BezierData GetBizerQuadData( IPositionObject target, Vector2 start, Vector2 end, float interval, System.Action <GameObject> onComplete = null, float linearFactor = 0.25f, float orthoFactor = 0.25f) { Vector2 midPoint = BosMath.ControlPoint(start, end, linearFactor, orthoFactor, 1); Vector3[] points = new Vector3[] { start, midPoint, end }; return(new BezierData() { Target = target, Interval = interval, OnComplete = onComplete, Points = points, Type = BezierType.Quadratic }); }
private void update() { IDataConsumer cons = this; ReferenceFrame frame = position.GetParentFrame(); int ncol = colored ? 3 : 1; foreach (IPhysicalField field in fieldAliases.Keys) { IPositionObject po = field as IPositionObject; ReferenceFrame ff = po.Position.GetParentFrame(); ReferenceFrame.GetRelativeFrame(ff, frame, relative); Dictionary <int, Transformer> d = fieldAliases[field]; foreach (int nf in d.Keys) { Transformer tr = d[nf]; FieldTransformer transfomer = tr.tr; tr.tr.Set(relative); } int fc = facet.Count; for (int i = 0; i < fc; i++) { double[] p = facet[i]; relative.GetRelativePosition(p, pos); object[] o = field[pos]; foreach (int nf in d.Keys) { Transformer tr = d[nf]; object ot = tr.tr.Transform(o[nf]); tr.an.SetValue(ot); } foreach (int ns in surfaceAliaes.Keys) { object sp = facet[i, ns]; surfaceAliaes[ns].SetValue(sp); } this.FullReset(); cons.UpdateChildrenData(); for (int j = 0; j < measures.Count; j++) { parameters[i, j] = measures[j].Parameter(); } if (colorMea[0] == null) { continue; } for (int nnc = 0; nnc < ncol; nnc++) { double col = (double)colorMea[0].Parameter(); if (proportional) { if (i == 0) { min[nnc] = col; max[nnc] = col; } else { if (min[nnc] > col) { min[nnc] = col; } if (max[nnc] < col) { max[nnc] = col; } } colorValues[i, nnc] = col; } } } } if (colorMea[0] != null) { draw(); } }
void post() { IPositionObject po = relative; po.Position = pos; }