private CartesianAnomaly CreateAnomaly(MeshParameters mesh, LateralDimensions lateral) { _logger.WriteStatus("\tCreating anomaly ..."); var size = new Size2D(mesh.Nx, mesh.Ny); var layers = new CartesianAnomalyLayer[mesh.Nz]; var zFragmentation = mesh.CreateAnomalyFragmentation(_minZ, _maxZ); WriteZFragmentation(zFragmentation); _logger.WriteStatus("\tCreating anomaly layers ..."); for (int i = 0; i < layers.Length; i++) { layers[i] = new CartesianAnomalyLayer(zFragmentation[i], zFragmentation[i + 1] - zFragmentation[i]); } var anomaly = new CartesianAnomaly(size, layers); anomaly.CreateSigma(); _logger.WriteStatus("Anomaly structure created"); FillModelDueToTopography(lateral, anomaly); return(anomaly); }
/// <summary> /// Create a new mesh from a MeshParameters object /// </summary> /// <param name="parameters"> /// A <see cref="MeshParameters"/> /// </param> /// <returns> /// A <see cref="Mesh"/> /// </returns> public static Mesh CreateMeshFromParameters(MeshParameters parameters) { Mesh mesh = new Mesh(); mesh.vertices = parameters.vertices; if (parameters.bindPoses != null && parameters.bindPoses.Length > 0) { mesh.bindposes = parameters.bindPoses; } if (parameters.boneWeights != null && parameters.boneWeights.Length > 0) { mesh.boneWeights = parameters.boneWeights; } if (parameters.colors != null && parameters.colors.Length > 0) { mesh.colors = parameters.colors; } mesh.normals = parameters.normals; if (parameters.tangents != null && parameters.tangents.Length > 0) { mesh.tangents = parameters.tangents; } mesh.triangles = parameters.triangles; mesh.uv = parameters.uv; if (parameters.uv2 != null && parameters.uv2.Length > 0) { mesh.uv2 = parameters.uv2; } return(mesh); }
void Start() { _hmd = HmdParameters.Instance; _mesh = MeshParameters.Instance; UpdateControls(); InterlensDistanceSlider.onValueChanged.AddListener((val) => _hmd.InterlensDistance = 0.001f * val); ScreenToLensDistSlider.onValueChanged.AddListener((val) => _hmd.ScreenToLensDist = 0.001f * val); EyeOffsetYSlider.onValueChanged.AddListener((val) => _hmd.EyeOffsetY = 0.001f * val); DistortionK1Slider.onValueChanged.AddListener((val) => _hmd.DistortionK1 = val); DistortionK2Slider.onValueChanged.AddListener((val) => _hmd.DistortionK2 = val); FovLeftSlider.onValueChanged.AddListener((val) => _hmd.MaxFovAngles = new Fov(val, _hmd.MaxFovAngles.Right, _hmd.MaxFovAngles.Bottom, _hmd.MaxFovAngles.Top)); FovRightSlider.onValueChanged.AddListener((val) => _hmd.MaxFovAngles = new Fov(_hmd.MaxFovAngles.Left, val, _hmd.MaxFovAngles.Bottom, _hmd.MaxFovAngles.Top)); FovTopSlider.onValueChanged.AddListener((val) => _hmd.MaxFovAngles = new Fov(_hmd.MaxFovAngles.Left, _hmd.MaxFovAngles.Right, _hmd.MaxFovAngles.Bottom, val)); FovBottomSlider.onValueChanged.AddListener((val) => _hmd.MaxFovAngles = new Fov(_hmd.MaxFovAngles.Left, _hmd.MaxFovAngles.Right, val, _hmd.MaxFovAngles.Top)); MeshHorizontalSegmentsSlider.onValueChanged.AddListener((val) => _mesh.SegmentWidth = (int)val); MeshVerticalSegmentsSlider.onValueChanged.AddListener((val) => _mesh.SegmentHeight = (int)val); GridToggle.onValueChanged.AddListener((val) => GridCm.SetActive(val)); RestoreDefaultsButton.onClick.AddListener(RestoreDefaultSettings); LoadButton.onClick.AddListener(LoadSettings); SaveButton.onClick.AddListener(SaveSettings); }
public CommemiModelSettings(MeshParameters mesh, ManualBoundaries manualBoundaries) : base(mesh, manualBoundaries) { AnomalySizeInMeters = 40000; LeftConductivity = 1; RightConductivity = 0.01; }
public CommemiModelSettings(MeshParameters mesh) : base(mesh) { AnomalySizeInMeters = 40000; LeftConductivity = 1; RightConductivity = 0.01; }
public CartesianModel CreateModel(MeshParameters mesh, decimal xCellSize, decimal yCellSize) { var lateral = new LateralDimensions(mesh.Nx, mesh.Ny, xCellSize, yCellSize); var section1D = CreateSection1D(); var anomaly = CreateAnomaly(mesh, lateral); var model = new CartesianModel(lateral, section1D, anomaly); return(model); }
private CartesianModel Convert(MeshParameters meshParameters, int localNxStart, int localNxLength, bool createSigma) { _createSigma = createSigma; LocalNxStart = localNxStart; LocalNxLength = localNxLength; var anomalyFragmentation = meshParameters.HasPredefinedAnomalyFragmentation ? meshParameters.GetPredefinedAnomalyFragmentation() : CreateAnomalyFragmentation(meshParameters, GetMinZ(), GetMaxZ()); return(Convert(meshParameters, anomalyFragmentation)); }
private CartesianModel Convert(MeshParameters mesh, decimal[] anomalyZSegmentation) { var xCellSize = (EndX - StartX) / mesh.Nx; var yCellSize = (EndY - StartY) / mesh.Ny; if (!CheckSimpleGriddingPossibility(xCellSize, yCellSize)) { throw new InvalidOperationException("!CheckSimpleGriddingPossibility(xCellSize, yCellSize)"); } var lateral = new LateralDimensions(mesh.Nx, mesh.Ny, xCellSize, yCellSize); var section1D = GetSection1D(); var anomaly = ConvertAnomaly(lateral, section1D, anomalyZSegmentation); return(new CartesianModel(lateral, section1D, anomaly)); }
private void OnGUI() { HmdParameters hmd = HmdParameters.Instance; MeshParameters mesh = MeshParameters.Instance; EditorGUILayout.BeginVertical("box"); EditorGUILayout.LabelField("HMD Settings"); hmd.DistortionK1 = EditorGUILayout.Slider("DistortionK1", hmd.DistortionK1, 0f, 2f, GUILayout.ExpandWidth(true)); hmd.DistortionK2 = EditorGUILayout.Slider("DistortionK2", hmd.DistortionK2, 0f, 2f, GUILayout.ExpandWidth(true)); hmd.InterlensDistance = EditorGUILayout.Slider("InterlensDistance", hmd.InterlensDistance, 0f, 0.2f, GUILayout.ExpandWidth(true)); hmd.ScreenToLensDist = EditorGUILayout.Slider("ScreenToLensDist", hmd.ScreenToLensDist, 0.01f, 0.2f, GUILayout.ExpandWidth(true)); hmd.EyeOffsetY = EditorGUILayout.Slider("EyeOffsetY", hmd.EyeOffsetY, 0f, 0.2f, GUILayout.ExpandWidth(true)); EditorGUILayout.BeginVertical("box"); EditorGUILayout.LabelField("FoV"); float fovLeft = EditorGUILayout.Slider("Left", hmd.MaxFovAngles.Left, 0f, 89f, GUILayout.ExpandWidth(true)); float fovRight = EditorGUILayout.Slider("Right", hmd.MaxFovAngles.Right, 0f, 89f, GUILayout.ExpandWidth(true)); float fovTop = EditorGUILayout.Slider("Top", hmd.MaxFovAngles.Top, 0f, 89f, GUILayout.ExpandWidth(true)); float fovBottom = EditorGUILayout.Slider("Bottom", hmd.MaxFovAngles.Bottom, 0f, 89f, GUILayout.ExpandWidth(true)); hmd.MaxFovAngles = new Fov(fovLeft, fovRight, fovBottom, fovTop); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("box"); EditorGUILayout.LabelField("Mesh Settings"); mesh.SegmentWidth = EditorGUILayout.IntSlider("SegmentWidth", mesh.SegmentWidth, 1, 16, GUILayout.ExpandWidth(true)); mesh.SegmentHeight = EditorGUILayout.IntSlider("SegmentHeight", mesh.SegmentHeight, 1, 16, GUILayout.ExpandWidth(true)); EditorGUILayout.EndVertical(); if (GUILayout.Button("Restore defaults", GUILayout.ExpandWidth(false))) { hmd.LoadDefaults(); mesh.LoadDefaults(); } }
private decimal[] CreateAnomalyFragmentation(MeshParameters mesh, decimal minZ, decimal maxZ) { var anomalyFragmentation = new List <decimal>(); if (mesh.UseGeometricStepAlongZ) { var z0 = minZ; anomalyFragmentation.Add(z0); var thick0 = (double)(maxZ - minZ) * (mesh.GeometricRation - 1.0) / (Math.Pow(mesh.GeometricRation, mesh.Nz) - 1); //decimal nextZ = Math.Floor((decimal)((double)z0 + thick0)); decimal nextZ = ((decimal)((double)z0 + thick0)); anomalyFragmentation.Add(nextZ); for (int i = 1; i < mesh.Nz - 1; i++) { var thick = thick0 * Math.Pow(mesh.GeometricRation, i); //nextZ = Math.Floor((decimal)((double)nextZ + thick)); nextZ = ((decimal)((double)nextZ + thick)); anomalyFragmentation.Add(nextZ); } anomalyFragmentation.Add(maxZ); } else { decimal zCellSize = (maxZ - minZ) / mesh.Nz; for (decimal z = minZ; z <= maxZ; z += zCellSize) { anomalyFragmentation.Add(z); } } return(anomalyFragmentation.ToArray()); }
public void ReadMeshParameters() { meshParameters = new MeshParameters(); for (int i = 0; i < nodeHeader.controllers.Length; i++) { Controller c = nodeHeader.controllers[i]; ControllerData d = nodeHeader.controllerData[i]; switch (c.controllerType) { case 100: meshParameters.selfIllumColor = new Color( d.data[0][0], d.data[0][0], d.data[0][0] ); break; case 128: meshParameters.alpha = d.data[0][0]; break; } } }
public OneBlockModelSettings(MeshParameters mesh) : base(mesh) { }
public OneBlockModelSettings(MeshParameters mesh, ManualBoundaries manualBoundaries) : base(mesh, manualBoundaries) { }
/// <summary> /// Create a new mesh from a MeshParameters object /// </summary> /// <param name="parameters"> /// A <see cref="MeshParameters"/> /// </param> /// <returns> /// A <see cref="Mesh"/> /// </returns> public static Mesh CreateMeshFromParameters(MeshParameters parameters) { Mesh mesh = new Mesh(); mesh.vertices = parameters.vertices; if (parameters.bindPoses!=null && parameters.bindPoses.Length>0) mesh.bindposes = parameters.bindPoses; if (parameters.boneWeights!=null && parameters.boneWeights.Length>0) mesh.boneWeights = parameters.boneWeights; if (parameters.colors!=null && parameters.colors.Length>0) mesh.colors = parameters.colors; mesh.normals = parameters.normals; if (parameters.tangents!=null && parameters.tangents.Length>0) mesh.tangents = parameters.tangents; mesh.triangles = parameters.triangles; mesh.uv = parameters.uv; if (parameters.uv2!=null && parameters.uv2.Length>0) mesh.uv2 = parameters.uv2; return mesh; }
public Commemi3D3ModelSettings(MeshParameters mesh) : base(mesh) { }
public Commemi3D3ModelSettings(MeshParameters mesh, ManualBoundaries manualBoundaries) : base(mesh, manualBoundaries) { }
void OnEnable() { _meshParams = MeshParameters.Instance; Refresh(_meshParams.SegmentWidth, _meshParams.SegmentHeight); _meshParams.ParamsChanged.AddListener(Refresh); }
public CartesianModel Convert(MeshParameters meshParameters) => Convert(meshParameters, 0, meshParameters.Nx);
public CartesianModel Convert(MeshParameters meshParameters, int localNxStart, int localNxLength) => Convert(meshParameters, localNxStart, localNxLength, createSigma: true);
public CartesianModel ConvertWithoutAnomalyData(MeshParameters meshParameters) => Convert(meshParameters, 0, meshParameters.Nx, createSigma: false);