Exemple #1
0
        public VectorData GetVector(IProcessingTextBlock normalBlock, NormalizationType normalization)
        {
            var      normal = styleFactory.ConstructTextBlock(normalBlock.Sentences);
            DataTree tree;

            switch (anomalyVectorType)
            {
            case AnomalyVectorType.Full:
                tree = new DataTree(normal, MapFull);
                break;

            case AnomalyVectorType.Inquirer:
                tree = normal.InquirerFinger.InquirerProbabilities;
                break;

            case AnomalyVectorType.SentimentCategory:
                tree = GetTree(normal);
                break;

            default:
                throw new ArgumentOutOfRangeException("AnomalyVectorType");
            }

            VectorData vector = tree.CreateVector(normalization);

            return(vector);
        }
        public void ByViewAndVectorAnalysisData_ValidArgs()
        {
            var samplePoints = new[]
            {
                Point.ByCoordinates(0, 2, 4),
                Point.ByCoordinates(0, 7, 4),
                Point.ByCoordinates(0, 19, 4)
            };

            var sampleValues = new[]
            {
                Vector.ByCoordinates(0, 2, 4),
                Vector.ByCoordinates(0, 7, 4),
                Vector.ByCoordinates(0, 19, 4)
            };

            var data = VectorData.ByPointsAndValues(
                samplePoints,
                sampleValues);

            var doc  = Document.Current;
            var grid = VectorAnalysisDisplay.ByViewAndVectorAnalysisData(doc.ActiveView, data);

            Assert.NotNull(grid);
        }
        public void ByViewAndVectorAnalysisData_BadArgs()
        {
            var samplePoints = new[]
            {
                Point.ByCoordinates(0, 2, 4),
                Point.ByCoordinates(0, 7, 4),
                Point.ByCoordinates(0, 19, 4)
            };

            var sampleValues = new[]
            {
                Vector.ByCoordinates(0, 2, 4),
                Vector.ByCoordinates(0, 7, 4),
                Vector.ByCoordinates(0, 19, 4)
            };

            var data = VectorData.ByPointsAndValues(
                samplePoints,
                sampleValues);

            var doc = Document.Current;

            Assert.Throws(typeof(System.ArgumentNullException), () => VectorAnalysisDisplay.ByViewAndVectorAnalysisData(null, data));
            Assert.Throws(typeof(System.ArgumentNullException), () => VectorAnalysisDisplay.ByViewAndVectorAnalysisData(doc.ActiveView, null));
        }
Exemple #4
0
        void ReceiverOmap_MsgReceived(DspMessage msg)
        {
            switch (msg.Type)
            {
            case MsgType.MsgType_Data_VectorData:
                var vector = msg.GetDataAsStruct <DSPMsg_VectorData>();
                if ((DataSaveType)vector.SaveType != DataSaveType.TimeSave)
                {
                    var vectors = new VectorData[8];
                    foreach (var vec in VectorsQueue)
                    {
                        vectors[vec.ChannelId - 4] = vec;
                    }
                    DatasReceived(vectors);
                    VectorsQueue.Clear();
                }
                break;

            case MsgType.MsgType_Data_WaveData:
                WavesQueue.Enqueue(DSPMsg_WaveData.ParseWave(msg));
                if (WavesQueue.Count >= ChannelCount)
                {
                    var waves = new WaveData[8];
                    foreach (var wave in WavesQueue)
                    {
                        waves[wave.ChannelId - 4] = wave;
                    }
                    DatasReceived(waves);
                    WavesQueue.Clear();
                }
                break;
            }
        }
 public InstrDecoder(Opcode opcode, InstrClass iclass, VectorData vectorData, params Mutator[] mutators)
 {
     this.opcode     = opcode;
     this.iclass     = iclass;
     this.vectorData = vectorData;
     this.mutators   = mutators;
 }
Exemple #6
0
 public LiftPositions(Vector3 bottom, Vector3 top, float rotationBottom, float rotationTop)
 {
     this.bottom         = bottom;
     this.top            = top;
     this.rotationBottom = rotationBottom;
     this.rotationTop    = rotationTop;
 }
        public override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters, ClientPeer peer)
        {
            VectorData pos = DictTool.GetProtoByDtoData <VectorData>(operationRequest.Parameters, ParameterCode.Position);

            //MyGameServer.LogInfo("x = "+ pos.X + "y= " + pos.Y + "z = " + pos.Z);
            peer.posData = pos;
        }
Exemple #8
0
        public static VectorAnalysisDisplay ByViewAndVectorAnalysisData(View view,
                                                                        VectorData data,
                                                                        string name = "", string description = "", Type unitType = null)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }

            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            if (string.IsNullOrEmpty(name))
            {
                name = Properties.Resources.AnalysisResultsDefaultName;
            }

            if (string.IsNullOrEmpty(description))
            {
                description = Properties.Resources.AnalysisResultsDefaultDescription;
            }

            return(new VectorAnalysisDisplay(view.InternalView, data, name, description, unitType));
        }
Exemple #9
0
        /// <summary>
        /// Create a Vector Analysis Display in the current view
        /// </summary>
        /// <param name="view"></param>
        /// <param name="data"></param>
        /// <param name="resultsName"></param>
        /// <param name="description"></param>
        /// <param name="unitType"></param>
        private VectorAnalysisDisplay(Autodesk.Revit.DB.View view, VectorData data,
                                      string resultsName, string description, Type unitType)
        {
            var sfm = GetSpatialFieldManagerFromView(view);

            TransactionManager.Instance.EnsureInTransaction(Document);

            sfm.Clear();

            sfm.SetMeasurementNames(new List <string>()
            {
                Properties.Resources.Dynamo_AVF_Data_Name
            });

            var primitiveIds = new List <int>();

            InternalSetSpatialFieldManager(sfm);

            var primitiveId = SpatialFieldManager.AddSpatialFieldPrimitive();

            InternalSetSpatialFieldValues(primitiveId, data, resultsName, description, unitType);
            primitiveIds.Add(primitiveId);

            TransactionManager.Instance.TransactionTaskDone();
        }
 public InstrDecoder(Mnemonic opcode, InstrClass iclass, VectorData vectorData, params Mutator <AArch64Disassembler>[] mutators)
 {
     this.opcode     = opcode;
     this.iclass     = iclass;
     this.vectorData = vectorData;
     this.mutators   = mutators;
 }
Exemple #11
0
 public PrefabData(string category, uint id, Vector3 position, Quaternion rotation, Vector3 scale)
 {
     this.category = category;
     this.id       = id;
     this.position = position;
     this.rotation = rotation;
     this.scale    = scale;
 }
Exemple #12
0
        private bool IsTriangleUnder(int pos1, int pos2, int pos3)
        {
            VectorData pos1V3 = vertexGlobalPos.Find((VectorData a) => { return(a.index == pos1); });
            VectorData pos2V3 = vertexGlobalPos.Find((VectorData a) => { return(a.index == pos2); });
            VectorData pos3V3 = vertexGlobalPos.Find((VectorData a) => { return(a.index == pos3); });

            return(pos1V3.isUnderTerrain && pos2V3.isUnderTerrain && pos3V3.isUnderTerrain);
        }
Exemple #13
0
 public EnvData(int ad, SelectedObjectData sk, SelectedObjectData ac, Camera cam)
 {
     action_dim        = ad;
     obs_dim           = 10; //dummy variable
     score_keeper      = sk;
     action_controller = ac;
     camera_p          = new VectorData(cam.transform.position);
     camera_hpr        = new VectorData(cam.transform.rotation.eulerAngles);
 }
Exemple #14
0
        public void VectorAnalysisDataByPointsAndResults_ValidArgs()
        {
            var vad = VectorData.ByPointsAndValues(TestPoints(), TestVectorResults());

            Assert.NotNull(vad);
            Assert.NotNull(vad.ValueLocations);
            Assert.NotNull(vad.Values);
            Assert.AreEqual(vad.Values.Count, 3);
        }
Exemple #15
0
 protected override void Awake()
 {
     base.Awake();
     OnInitialized += SimManager.OnMapLoaded;
     if (FilterHeight > 1)
     {
         VectorData.GetFeatureSubLayerAtIndex(0)?.filterOptions.AddNumericFilterGreaterThan("height", FilterHeight);
     }
 }
Exemple #16
0
 public VectorRegisterOperand(
     PrimitiveType dt,
     RegisterStorage reg,
     VectorData elementType) : this(dt, reg, elementType, -1)
 {
     this.VectorRegister = reg;
     this.ElementType    = elementType;
     this.Index          = -1;
 }
Exemple #17
0
 public SpawnRandomizer(AsteroidObjectList list)
 {
     use_randomizer = list.use_spawn_randomizer;
     number         = list.spawn_number;
     plane_position = new VectorData(list.transform.position);
     plane_normal   = new VectorData(list.transform.TransformVector(new Vector3(0, 1, 0)).normalized);
     plane_u        = new VectorData(list.transform.TransformVector(new Vector3(1, 0, 0)).normalized);
     x = list.spawn_x;
     y = list.spawn_y;
 }
Exemple #18
0
 public VectorRegisterOperand(
     PrimitiveType dt,
     RegisterStorage reg,
     VectorData elementType,
     int index) : base(dt)
 {
     this.VectorRegister = reg;
     this.ElementType    = elementType;
     this.Index          = index;
 }
Exemple #19
0
 public PhysicsOptionsData(AsteroidObject obj)
 {
     name     = obj.material.material_name;
     position = new VectorData(obj.gameObject.transform.position);
     rotation = new VectorData(obj.gameObject.transform.rotation.eulerAngles);
     scale    = new VectorData(obj.gameObject.transform.lossyScale);
     velocity = new VectorData(obj.velocity);
     rigid    = true;
     mass     = obj.mass;
 }
        public override double CalculateDistance(VectorData a, VectorData b)
        {
            double sum = 0;
            for (var i = 0; i < a.Data.Count(); i++)
            {
                sum += Math.Pow((a.Data.Skip(i).First() - b.Data.Skip(i).First()), 2);
            }

            return Math.Sqrt(sum);
        }
 protected override void Awake()
 {
     if (PotatoMode)
     {
         Options.extentOptions.extentType = MapExtentType.RangeAroundCenter;
     }
     base.Awake();
     if (FilterHeight > 1)
     {
         VectorData.GetFeatureSubLayerAtIndex(0)?.filterOptions.AddNumericFilterGreaterThan("height", FilterHeight);
     }
 }
Exemple #22
0
    public override void DefaultRequest()
    {
        VectorData vectorData = new VectorData()
        {
            X = pos.x, Y = pos.y, Z = pos.z
        };

        Dictionary <byte, object> data = DictTool.GetDtoDataByProto(vectorData, ParameterCode.Position);

        Debug.Log("SyncPositionRequest send " + OpCode.ToString());
        PhotonEngine.Peer.OpCustom((byte)OpCode, data, true);
    }
Exemple #23
0
 public void RefreshPanel()
 {
     HorizPipeLengthInput.text    = "";
     MakePipeLengthInput.text     = "";
     JingXieJiaoInput.text        = "";
     VerticalPipeLenghtInput.text = "";
     TotalPipeLengthInput.text    = "";
     if (vectorDatas != null)
     {
         for (int i = 0; i < vectorDatas.Count; i++)
         {
             VectorData vecData = vectorDatas[i];
             DestroyImmediate(vecData.gameObject);
         }
         vectorDatas.Clear();
     }
 }
Exemple #24
0
        private static int Bitsize(VectorData data)
        {
            switch (data)
            {
            case VectorData.I8: return(8);

            case VectorData.I16: return(16);

            case VectorData.I32: return(32);

            case VectorData.I64: return(64);

            case VectorData.F16: return(16);

            case VectorData.F32: return(32);

            case VectorData.F64: return(64);
            }
            return(0);
        }
Exemple #25
0
    public ConstraintData(AsteroidConstraint constraint, List <AsteroidObject> asteroidObjectList)
    {
        obj_id1 = asteroidObjectList.FindIndex(a => a == constraint.object1);
        obj_id2 = asteroidObjectList.FindIndex(a => a == constraint.object2);

        type = (int)constraint.type;

        var1 = constraint.var1;
        var2 = constraint.var2;
        var3 = constraint.var3;

        pos1 = new VectorData(constraint.object1.transform.position);
        hpr1 = new VectorData(constraint.object1.transform.rotation.eulerAngles);

        if (constraint.object2)
        {
            pos2 = new VectorData(constraint.object2.transform.position);
            hpr2 = new VectorData(constraint.object2.transform.rotation.eulerAngles);
        }
    }
Exemple #26
0
        public void VectorAnalysisDataByPointsAndResults_BadArgs()
        {
            Assert.Throws <ArgumentNullException>(
                () =>
                VectorData.ByPointsAndValues(
                    null,
                    TestVectorResults()));

            Assert.Throws <ArgumentNullException>(
                () =>
                VectorData.ByPointsAndValues(
                    TestPoints(),
                    null));

            Assert.Throws <ArgumentException>(
                () =>
                VectorData.ByPointsAndValues(
                    new [] { Point.ByCoordinates(0, 0) },
                    TestVectorResults()));
        }
Exemple #27
0
        private static int Bitsize(VectorData data)
        {
            switch (data)
            {
            case VectorData.I8: return(8);

            case VectorData.I16: return(16);

            case VectorData.I32: return(32);

            case VectorData.I64: return(64);

            case VectorData.F16: return(16);

            case VectorData.F32: return(32);

            case VectorData.F64: return(64);
            }
            Debug.Assert(false, "Impossiburu");
            return(0);
        }
Exemple #28
0
        /// <summary>
        /// Set the spatial field values for the current spatial field primitive.  The two
        /// input sequences should be of the same length.
        /// </summary>
        /// <param name="data"></param>
        /// <param name="schemaName"></param>
        /// <param name="description"></param>
        /// <param name="unitType"></param>
        private void InternalSetSpatialFieldValues(int primitiveId, VectorData data, string schemaName, string description, Type unitType)
        {
            var valList = data.Values.Select(v => new VectorAtPoint(new List <XYZ> {
                v.ToXyz()
            }));

            TransactionManager.Instance.EnsureInTransaction(Document);

            var sampleValues = new FieldValues(valList.ToList());

            // Convert the sample points to a special Revit Type
            var samplePts = new FieldDomainPointsByXYZ(data.ValueLocations.Select(p => p.ToXyz()).ToList());

            // Get the analysis results schema
            var schemaIndex = GetAnalysisResultSchemaIndex(schemaName, description, unitType);

            // Update the values
            SpatialFieldManager.UpdateSpatialFieldPrimitive(primitiveId, samplePts, sampleValues, schemaIndex);

            TransactionManager.Instance.TransactionTaskDone();
        }
Exemple #29
0
        /// <summary>
        /// Create a Vector Analysis Display in the current view
        /// </summary>
        /// <param name="view"></param>
        /// <param name="data"></param>
        /// <param name="resultsName"></param>
        /// <param name="description"></param>
        /// <param name="unitType"></param>
        private VectorAnalysisDisplay(Autodesk.Revit.DB.View view, VectorData data,
                                      string resultsName, string description, Type unitType)
        {
            SpatialFieldManager sfm;
            var primitiveIds = new List <int>();

            TransactionManager.Instance.EnsureInTransaction(Document);

            var TraceData = GetElementAndPrimitiveIdFromTrace();

            if (TraceData != null)
            {
                sfm          = TraceData.Item1;
                primitiveIds = TraceData.Item2;
                foreach (var idx in primitiveIds)
                {
                    sfm.RemoveSpatialFieldPrimitive(idx);
                }
                primitiveIds.Clear();
            }
            else
            {
                sfm = GetSpatialFieldManagerFromView(view);

                sfm.SetMeasurementNames(new List <string>()
                {
                    Properties.Resources.Dynamo_AVF_Data_Name
                });
            }

            InternalSetSpatialFieldManager(sfm);

            var primitiveId = SpatialFieldManager.AddSpatialFieldPrimitive();

            InternalSetSpatialFieldValues(primitiveId, data, resultsName, description, unitType);
            primitiveIds.Add(primitiveId);
            InternalSetSpatialPrimitiveIds(primitiveIds);
            TransactionManager.Instance.TransactionTaskDone();
            SetElementAndPrimitiveIdsForTrace(sfm, primitiveIds);
        }
Exemple #30
0
        /// <summary>
        /// Show a Vector Analysis Display in the Revit view.
        /// </summary>
        /// <param name="view">The view into which you want to draw the analysis results.</param>
        /// <param name="samplePoints">The locations at which you want to create analysis values.</param>
        /// <param name="samples">The analysis values at the given locations.</param>
        /// <param name="name">An optional analysis results name to show on the results legend.</param>
        /// <param name="description">An optional analysis results description to show on the results legend.</param>
        /// <param name="unitType">An optional Unit type to provide conversions in the analysis results.</param>
        /// <returns>A VectorAnalysisDisplay object.</returns>
        public static VectorAnalysisDisplay ByViewPointsAndVectorValues(View view,
                                                                        Autodesk.DesignScript.Geometry.Point[] sampleLocations, Vector[] samples,
                                                                        string name = "", string description = "", Type unitType = null)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }

            if (sampleLocations == null)
            {
                throw new ArgumentNullException("samplePoints");
            }

            if (samples == null)
            {
                throw new ArgumentNullException("samples");
            }

            if (sampleLocations.Length != samples.Length)
            {
                throw new Exception(Properties.Resources.SamplePointsMismatchError);
            }

            if (string.IsNullOrEmpty(name))
            {
                name = Properties.Resources.AnalysisResultsDefaultName;
            }

            if (string.IsNullOrEmpty(description))
            {
                description = Properties.Resources.AnalysisResultsDefaultDescription;
            }

            var data = VectorData.ByPointsAndValues(sampleLocations, samples);

            return(new VectorAnalysisDisplay(view.InternalView, data, name, description, unitType));
        }
Exemple #31
0
        public static void WriteName(int bitSize, RegisterStorage VectorRegister, VectorData ElementType, int Index, MachineInstructionRenderer renderer)
        {
            renderer.WriteString(VectorRegister.Name);
            renderer.WriteChar('.');
            switch (ElementType)
            {
            case VectorData.I8:
                if (Index >= 0)
                {
                    renderer.WriteString("b");
                }
                else if (bitSize == 64)
                {
                    renderer.WriteString("8b");
                }
                else
                {
                    renderer.WriteString("16b");
                }
                break;

            case VectorData.I16:
                if (Index >= 0)
                {
                    renderer.WriteString("h");
                }
                else if (bitSize == 64)
                {
                    renderer.WriteString("4h");
                }
                else
                {
                    renderer.WriteString("8h");
                }
                break;

            case VectorData.I32:
                if (Index >= 0)
                {
                    renderer.WriteString("s");
                }
                else if (bitSize == 64)
                {
                    renderer.WriteString("2s");
                }
                else
                {
                    renderer.WriteString("4s");
                }
                break;

            case VectorData.I64:
                if (Index >= 0)
                {
                    renderer.WriteString("d");
                }
                else if (bitSize == 64)
                {
                    renderer.WriteString("1d");
                }
                else
                {
                    renderer.WriteString("2d");
                }
                break;

            case VectorData.I128:
                if (Index >= 0)
                {
                    renderer.WriteString("q");
                }
                else if (bitSize == 64)
                {
                    renderer.WriteString("1q??");
                }
                else
                {
                    renderer.WriteString("1q");
                }
                break;

            default:
                throw new NotImplementedException($"{ElementType}");
            }
        }
 public abstract double CalculateDistance(VectorData a, VectorData b);
 internal KDNode(VectorData values, int dimension)
 {
     Values = values;
     Dimension = dimension;
 }