public SpringMassSystem3D(Transform transform, Mesh mesh, SM_Material props) { SM_Utils.AutoWeld(mesh, VERT_THRESH, BUCKET_STEP); this.local2World = transform.localToWorldMatrix; this.mesh_verts = mesh.vertices; this.tri = mesh.triangles; this.props = props; elements = new List <Element>(); lookup = new SortedDictionary <int, Node>(); faceContribs = new Dictionary <Node, List <double> >(); k = props.Youngs * props.Thickness; double[,] st = { { k, k, k, -k, -k, -k }, { k, k, k, -k, -k, -k }, { k, k, k, -k, -k, -k }, { -k, -k, -k, k, k, k }, { -k, -k, -k, k, k, k }, { -k, -k, -k, k, k, k } }; connectivityMap = new List <int[]>(); localStiffnessMatrix = MB.DenseOfArray(st); FindElements(); FormStiffness3D(); FormMass3D(); }
public SpringMesh(Mesh mesh, SM_Material props) { this.mesh = mesh; this.props = props; edges = new List <SM_Edge>(); lookup = new SortedDictionary <int, SM_Vertex>(); ConvertMesh(); }
public ModalSynthesizer(Mesh mesh, SM_Material properties, int sampleRate = 44100) { this.sampleRate = sampleRate; SpringMesh fem = new SpringMesh(mesh, properties); mMass = fem.GetMassMatrix(); mStiffness = fem.GetGlobalStiffnessMatrix(); if (mStiffness.RowCount > USE_EXT_TOL) { /* * ext = ExternalLinalgHandler.Instance; * ParentBehaviour?.StartCoroutine(ext.UnityDebugProcessOutput()); * ext.ComputeExternal(mStiffness); * mGain = ext.EigenVectors; * mGain_inv = ext.EigenVectors_Inv; * mEig = ext.EigenValues; */ /* * using (ExternalLinalgHandler ext = new ExternalLinalgHandler()) * { * ParentBehaviour?.StartCoroutine(ext.UnityDebugProcessOutput()); * ext.ComputeExternal(K); * mGain = ext.EigenVectors; * mGain_inv = ext.EigenVectors_Inv; * mEig = ext.EigenValues; * } */ //ext.Dispose(); } else { Evd <double> evd = mStiffness.Evd(Symmetricity.Hermitian); mGain = evd.EigenVectors; mGain_inv = mGain.Inverse(); mEig = evd.EigenValues; } props = properties; nmodes = mEig.Count; omega_plus = new zdouble[nmodes]; omega_minus = new zdouble[nmodes]; SetModeProperties(); cGains = new zdouble[nmodes]; for (int i = 0; i < nmodes; i++) { cGains[i] = new zdouble(0.0, 0.0); } }
public static void DejectMaterialProperties() { _props = SM_Material.Default; }
public static void InjectMaterialProperties(SM_Material properties) { _props = properties; }