Beispiel #1
0
 public void Initialize(FieldLineCalculationSettings calculationSettings,
                        InteractionField fieldType,
                        FieldLineAppearanceSettings appearanceSettings,
                        IntegrationDirection integrationDirection)
 {
     settings                  = calculationSettings;
     this.fieldType            = fieldType;
     this.integrationDirection = integrationDirection;
     this.appearanceSettings   = appearanceSettings;
     SetUpCalculation();
 }
Beispiel #2
0
        public LineIntegral(CurveType type, IntegrationDirection direction, CurveArea area, double r)
        {
            double x;
            double y;
            double t = 2 * Math.PI;

            if (type == CurveType.Circle && area == CurveArea.Full)
            {
                if (direction == IntegrationDirection.Clockwise)
                {
                    x = r * Math.Cos(t);
                    y = r * Math.Cos(t);
                }
            }
        }
//    /// <summary>
//    /// Planar mode. Calculate each point of each field line associated with this geometry and stage for drawing.
//    /// Removed because the do-calculation command for each geometry should be independent of draw space setting.
//    /// </summary>
//    public virtual void CalculatePlanarFieldLines(int charge, Plane plane)
//    {
//        Vector4[] seeds = FieldLineSeedsInPlane(charge, plane);
//        AssociateModelsWithSeeds(seeds);
//        for (int i = 0; i < fieldLineModels.Count; i++)
//        {
//            CPUFieldLineModel model = fieldLineModels[i];
//            Vector4 seed = seeds[i];
//            Vector3 position = new Vector3(seed.x, seed.y, seed.z);
//            CPUFieldLineModel.IntegrationDirection integrationDirection = seed.w > 0
//                ? CPUFieldLineModel.IntegrationDirection.DownField
//                : CPUFieldLineModel.IntegrationDirection.UpField;
//            model.SetPositionAndIntegrationDirection(position, integrationDirection);
//            model.ExecuteCalculation();
//        }
//    }
//    /// <summary>
//    /// Volumetric mode. Calculate each point of each field line associated with this geometry and stage for drawing.
//    /// </summary>
//    public abstract void CalculateVolumetricFieldLines(int charge);

    public virtual void CalculateFieldLines()
    {
        AssociateModelsWithSeeds(storedSeeds);
        for (int i = 0; i < fieldLineModels.Count; i++)
        {
            CPUFieldLineModel    model                = fieldLineModels[i];
            Vector4              seed                 = storedSeeds[i];
            Vector3              position             = new Vector3(seed.x, seed.y, seed.z);
            IntegrationDirection integrationDirection = seed.w > 0
                ? IntegrationDirection.FromNegative
                : IntegrationDirection.FromPositive;
            model.SetPositionAndIntegrationDirection(position, integrationDirection);
            model.ExecuteCalculation();
        }
    }
Beispiel #4
0
 public void SetPositionAndIntegrationDirection(Vector3 position, IntegrationDirection direction)
 {
     integrationDirection = direction;
     transform.position   = position;
 }