Top 3 market leaders in the sneaker industry by milimport Sofa import numpy as np import pandas as pd import datetime import csv import time def createScene(root): root.gravity = [0, 0, 0] root.dt = 0.01 # Reduced time step for better numerical stability # Load required plugins plugins = [ 'Sofa.Component.Collision.Detection.Algorithm', 'Sofa.Component.Collision.Detection.Intersection', 'Sofa.Component.Collision.Geometry', 'Sofa.Component.Collision.Response.Contact', 'Sofa.Component.Constraint.Projective', 'Sofa.Component.IO.Mesh', 'Sofa.Component.LinearSolver.Iterative', 'Sofa.Component.Mapping.Linear', 'Sofa.Component.Mass', 'Sofa.Component.ODESolver.Backward', 'Sofa.Component.SolidMechanics.FEM.Elastic', 'Sofa.Component.StateContainer', 'Sofa.Component.Topology.Container.Dynamic', 'Sofa.Component.Visual', 'Sofa.GL.Component.Rendering3D', 'Sofa.Component.Topology.Container.Constant', 'Sofa.Component.Engine.Transform', 'Sofa.Component.MechanicalLoad', 'Sofa.GL.Component.Shader', 'Sofa.Component.SolidMechanics.Spring', 'SofaValidation', ] for plugin in plugins: root.addObject("RequiredPlugin", name=plugin) root.addObject('DefaultAnimationLoop') root.addObject('VisualStyle', displayFlags="showVisualModels showWireframe") root.addObject('DefaultPipeline', verbose="true") root.addObject('BruteForceBroadPhase') root.addObject('BVHNarrowPhase') root.addObject('DefaultContactManager', response="PenalityContactForceField") root.addObject('DiscreteIntersection') root.addObject('DirectionalLight', direction=[0, -1, -0.5], color=[2, 2, 2]) # Load organ meshes root.addObject("MeshGmshLoader", name="meshLoaderFineV", filename="./vein3.msh") root.addObject("MeshGmshLoader", name="meshLoaderFineA", filename="./art3.msh") root.addObject("MeshGmshLoader", name="meshLoaderFine", filename="./justkidney1.msh") # Vein scale = 0.1 vene = root.addChild("vene") vene.addObject("EulerImplicitSolver", rayleighStiffness="0.1", rayleighMass="0.1") vene.addObject("CGLinearSolver", iterations="25", tolerance="1e-09", threshold="1e-09") vene.addObject('MeshGmshLoader', name="meshLoaderV", filename="./vein3.msh") vene.addObject("TetrahedronSetTopologyContainer", name="topov", src="@meshLoaderV") vene.addObject("MechanicalObject", template="Vec3d", name="MechanicalModelv", scale3d=[scale, scale, scale], showColor="255 255 255 255", showObject=True) vene.addObject("TetrahedronSetGeometryAlgorithms") vene.addObject('DiagonalMass', massDensity="1.0") vene.addObject('BVHNarrowPhase') vene.addObject("TetrahedralCorotationalFEMForceField", poissonRatio="0.49", youngModulus="10000") # All provided surface indices vene.addObject("FixedConstraint", indices="1687 1673 1543 1610 1630 1647 1714 1688 722 730") visualv = vene.addChild("Visualv") visualv.addObject("OglModel", src="@../../meshLoaderFineV", scale3d=[scale, scale, scale], material="Default Diffuse 1 0 0 1 1") visualv.addObject("IdentityMapping", template="Vec3d,Vec3d", input="@..", output="@.") # Monitor vein indices vene_vec_monitor = vene.addChild("Monitor") surface_indices_vene_vec_monitor = "421 451 481 511 541 571 601 631 661 691 721 751 781 811 841 871 901 931 961 991 1021 1051 1081 1111 1141 1171 1201 1231 1261 1291 1321 1351 1381 1411 1441 1471 1501 1531 1561 1591 1621 1651 1681 1711 1741 1771 1801 1831 1861 1891 1921 1951 1981 2011 2041 2071 2101 2131 2161 2191 2221 2251 2281 2311 2341 2371 2401 2431 2461 2491 2521 2551 2581 2611 2641 2671 2701 2731 2761 2791 2821 2851 2881 2911 2941 2971" vene_vec_monitor.addObject("Monitor", template="Vec3d", name="interesting_points", listening="1", indices=surface_indices_vene_vec_monitor, showPositions="1", PositionsColor="1 0 0 1", showVelocities="0", VelocitiesColor="1 1 0 1", ForcesColor="1 1 0 1", showMinThreshold="0.01", TrajectoriesPrecision="0.1", TrajectoriesColor="1 0 0 1", sizeFactor="5", showForces="0", showTrajectories="0", ExportForces='true', ExportPositions='true', ExportVelocities='true') # Kidney kidney = root.addChild('kidney') kidney.addObject('EulerImplicitSolver', rayleighStiffness="0.1", rayleighMass="0.1") kidney.addObject('CGLinearSolver', iterations="25", tolerance="1e-09", threshold="1e-09") kidney.addObject('MeshGmshLoader', name="meshLoaderK", filename="./justkidney1.msh") kidney.addObject('TetrahedronSetTopologyContainer', name="topo", src="@meshLoaderK") kidney.addObject('MechanicalObject', template="Vec3d", name="dofs", scale3d=[scale, scale, scale], showColor="255 255 255 255", showObject=True) kidney.addObject('DiagonalMass', massDensity="1.0") kidney.addObject('BVHNarrowPhase') kidney.addObject('TetrahedralCorotationalFEMForceField', template="Vec3d", name="FEM", poissonRatio="0.44", youngModulus="30000", # Reduced young modulus for more deformation computeGlobalMatrix="0") # Apply the ConstantForceField kidney.addObject('ConstantForceField', name='forceField', indices='2200', forces='0 10 1000') # Increase force magnitude visu = kidney.addChild('Visu') visu.addObject('OglModel', src="@../../meshLoaderFine", scale3d=[scale, scale, scale], material="Default Diffuse 1 1 0.666667 0 1") visu.addObject('IdentityMapping', template="Vec3d,Vec3d", input="@..", output="@.") # Monitor kidney indices kidney_vec_monitor = kidney.addChild("Monitor") surface_indices_kidney_vec_monitor = "301 331 361 391 421 451 481 511 541 571 601 631 661 691 721 751 781 811 841 871 901 931 961 991 1021 1051 1081 1111 1141 1171 1201 1231 1261 1291 1321 1351 1381 1411 1441 1471 1501 1531 1561 1591 1621 1651 1681 1711 1741 1771 1801 1831 1861 1891 1921 1951 1981 2011 2041 2071 2101 2131 2161 2191 2221 2251 2281 2311 2341 2371 2401 2431 2461 2491 2521 2551 2581 2611 2641 2671 2701 2731 2761 2791 2821 2851 2881 2911 2941 2971 3001 3031 3061 3091 3121 3151 3181 3211 3241 3271 3301 3331 3361 3391 3421 3451 3481 3511 3541 3571 3601 3631 3661 3691 3721 3751 3781 3811 3841 3871 3901 3931 3961 3991 4021 4051 4081 4111 4141 4171 4201 4231 4261 4291 4321 4351" kidney_vec_monitor.addObject("Monitor", template="Vec3d", name="interesting_points", listening="1", indices=surface_indices_kidney_vec_monitor, showPositions="1", PositionsColor="0 0 1 1", showVelocities="0", VelocitiesColor="1 1 0 1", ForcesColor="1 1 0 1", showMinThreshold="0.01", TrajectoriesPrecision="0.1", TrajectoriesColor="0 0 1 1", sizeFactor="5", showForces="0", showTrajectories="0", ExportForces='true', ExportPositions='true', ExportVelocities='true') # Attach Constraint root.addObject("AttachConstraint", name="AttachConstraint4", object2="@vene/MechanicalModelv", object1="@kidney/dofs", indices2="1915 1916 1917 1918 1920 1923 1925 2678 2680 2681 2682 2683 2688 2701 2767 2770 2796 2798 2799 2802 2820 2933 2946 2953 2954 2955 2957 2961", indices1="1357 171 1356 171 171 171 171 2896 3857 3857 2896 2896 3859 2896 649 649 1899 2953 1899 649 649 543 2886 2884 2887 2886 2886 2886", positionFactor='0.05', twoWay='false', constraintFactor="1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1") # 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 root.addObject(ExampleController(root, surface_indices_kidney_vec_monitor,surface_indices_vene_vec_monitor)) root.addObject(ExampleController(root, surface_indices_kidney_vec_monitor, surface_indices_vene_vec_monitor)) class ExampleController(Sofa.Core.Controller): def __init__(self, node, surface_indices_kidney_vec_monitor, surface_indices_vene_vec_monitor): super().__init__() self.node = node self.surface_indices_kidney = [int(x) for x in surface_indices_kidney_vec_monitor.split()] self.surface_indices_vene = [int(x) for x in surface_indices_vene_vec_monitor.split()] ts = time.time() filename_kidney = f"E:\\SOFA\\data\\{datetime.datetime.fromtimestamp(ts).strftime('%Y%m%d%H%M%S')}-kidney.csv" filename_vene = f"E:\\SOFA\\data\\{datetime.datetime.fromtimestamp(ts).strftime('%Y%m%d%H%M%S')}-vene.csv" try: self.csv_file_kidney = open(filename_kidney, "w", newline="") self.csv_writer_kidney = csv.writer(self.csv_file_kidney) self.csv_file_vene = open(filename_vene, "w", newline="") self.csv_writer_vene = csv.writer(self.csv_file_vene) header_kidney = ( ["Time"] + [ f"Orientation_{j}_{i}" for i in range(len(self.surface_indices_kidney)) for j in ["x", "y", "z"] ] + [ f"Position_{j}_{i}" for i in range(len(self.surface_indices_kidney)) for j in ["x", "y", "z"] ] + [ f"Force_{j}_{i}" for i in range(len(self.surface_indices_kidney)) for j in ["x", "y", "z"] ] ) self.csv_writer_kidney.writerow(header_kidney) header_vene = ( ["Time"] + [ f"Position_{j}_{i}" for i in range(len(self.surface_indices_vene)) for j in ["x", "y", "z"] ] + [ f"Force_{j}_{i}" for i in range(len(self.surface_indices_vene)) for j in ["x", "y", "z"] ] ) self.csv_writer_vene.writerow(header_vene) print(f"Data logging initialized to: {filename_kidney}") print(f"Data logging initialized to: {filename_vene}") except IOError as e: print(f"Error opening file: {e}") self.csv_file_kidney = None self.csv_file_vene = None def init_csv_file(self, filename, kidney_name, kidney_indices, vene_name, vene_indices): try: with open(filename, 'w', newline='') as file: writer = csv.writer(file) headers = ['timestamp', 'component_type'] for indices, label in [(kidney_indices, kidney_name), (vene_indices, vene_name)]: headers.extend([ f'{label}_orientation_w', f'{label}_orientation_x', f'{label}_orientation_y', f'{label}_orientation_z' ] + [f'{label}_point_{i}_pos_x' for i in indices] + [f'{label}_point_{i}_pos_y' for i in indices] + [f'{label}_point_{i}_pos_z' for i in indices] + [f'{label}_point_{i}_force_x' for i in indices] + [f'{label}_point_{i}_force_y' for i in indices] + [f'{label}_point_{i}_force_z' for i in indices]) writer.writerow(headers) return True except Exception as e: print(f"Exception during CSV file initialization: {e}") return False def onAnimateBeginEvent(self, event): self.counter += 1 if self.counter % 100 == 0: # Log data every 100 frames print(f"Logging data at frame: {self.counter}") self.logData() def logData(self): if self.csv_file_kidney is None: print("CSV file is not available for writing.") return current_time = time.time() components = {"vene": "MechanicalModelv", "kidney": "dofs"} for comp_name, mo_name in components.items(): comp = self.node.getChild(comp_name) if comp: mo = comp.getObject(mo_name) if ( mo and hasattr(mo, "position") and mo.position and hasattr(mo, "force") and mo.force ): # Filter positions and forces based on the surface indices if comp_name == "vene": filtered_positions = [ mo.position.value[i][j] for i in self.surface_indices_vene for j in range(3) ] filtered_forces = [ mo.force.value[i][j] for i in self.surface_indices_vene for j in range(3) ] data_to_write = [ current_time, *filtered_positions, *filtered_forces, ] self.csv_writer_vene.writerow(data_to_write) elif comp_name == "kidney": orientation = self.compute_orientation(mo, self.surface_indices_kidney) filtered_positions = [ mo.position.value[i][j] for i in self.surface_indices_kidney for j in range(3) ] filtered_forces = [ mo.force.value[i][j] for i in self.surface_indices_kidney for j in range(3) ] data_to_write = [ current_time, *orientation, *filtered_positions, *filtered_forces, ] self.csv_writer_kidney.writerow(data_to_write) # for pos, force in zip(filtered_positions, filtered_forces): # data_to_write = [current_time, comp_name, *pos, *force] # self.csv_writer.writerow(data_to_write) print(f"Data saved for: {comp_name}") else: print( f"No position or force data available for {comp_name}, or the MechanicalObject does not exist." ) else: print(f"Component '{comp_name}' not found in the scene.") self.csv_file_kidney.flush() self.csv_file_vene.flush() def compute_orientation(self, mo, indices): # Simplified placeholder to demonstrate orientation computation orientation_list = [] if len(indices) > 1 and len(mo.position.value) > max(indices): for i in indices: x = indices[0] y = indices[1] z = indices[2] magnitude = np.sqrt(x**2 + y**2 + z**2) if magnitude == 0: raise ValueError("Zero vector has no defined angles with coordinate axes.") # Angle with x-axis theta_x = np.arccos(x / magnitude) # Angle with y-axis theta_y = np.arccos(y / magnitude) # Angle with z-axis theta_z = np.arccos(z / magnitude) # Convert radians to degrees orientation_list.append(np.degrees(theta_x)) orientation_list.append(np.degrees(theta_y)) orientation_list.append(np.degrees(theta_z)) return orientation_list def onAnimateBeginEvent(self, event): self.logData() if __name__ == "__main__": createScene(Sofa.Core.Node())lions in market share

Hang on, finding our artistic inspiration
NameShare
Nike31.9
Adidas24.2
New Balance10.6
Under Armour9.4
Puma6.2
ASICS5.8
Others11.9

Icon 1
Icon 2
Topic to PPT using AIGenerate engaging presentations quickly from just a keyword. Ideal for students and educators needing fast, content-rich slides. Create PPT from Topic
Icon 1
Icon 2
Youtube to PPT using AITurn YouTube videos into informative slide presentations. Excellent for marketers and creators looking to expand their video content's reach. Create PPT from YouTube
Icon 1
Icon 2
AI PitchDeck GeneratorTurn Pitch Deck into informative slide presentations. Excellent for business and startup looking to present his business. Create PPT from Pitch Deck
Icon 1
Icon 2
Text to PPT using AIGenerate engaging presentations quickly from just a keyword. Ideal for students and educators needing fast, content-rich slides. Create PPT from Text
Icon 1
Icon 2
Url to PPT using AIEffortlessly convert any web page into a comprehensive presentation. Perfect for professionals and researchers presenting web-based data. Create PPT from URL
Icon 1
Icon 2
PDF to PPT using AIConvert PDF files to PowerPoint slides easily. Essential for analysts and consultants dealing with detailed reports. Create PPT from PDF
Icon 1
Icon 2
Docx to PPT using AITransform Word documents into dynamic presentations. Suitable for administrators and writers enhancing their documents visually. Create PPT from Docx
Icon 1
Icon 2
Tome Url to PPT using AIStuck with a Tome presentation? Convert it to PowerPoint format for use with Google Slides or PowerPoint effortlessly. Create PPT from Tome.app Url
Icon 1
Icon 2
Gamma Url to PPT using AIStuck with a Gamma presentation? Convert it to PowerPoint format for use with Google Slides or PowerPoint effortlessly. Create PPT from Gamma Url
Icon 1
Icon 2
Image to PPT using AIConvert Image to PPT with a single click. Click "upload Image" select your image and we will create presentation with the same. Create PPT from Image
Icon 1
Icon 2
MagicChartCreate charts from text online instantly. Streamline data visualization for presentations and reports. Create Chart from Text
Icon 1
Icon 2
PPT to JPGConvert PowerPoint slides to high-quality JPG images online. Useful for archiving or sharing presentations visually. Create JPG from PPT
Icon 1
Icon 2
PPT to PDFTurn your PowerPoint presentations into PDFs seamlessly. Ideal for securing and distributing presentations professionally. Create PDF from PPT
Icon 1
Icon 2
PPT to MP4Convert PowerPoint slides into MP4 videos. Great for creating shareable video content from presentations. Create MP4 from PPT
Icon 1
Icon 2
PPT to TextSingle click convert Your PPT to TXT File in Seconds - Free, Secure, and User-Friendly! Convert PPT to Text
Icon 1
Icon 2
PPT to Better PPThave a rought ppt just text and want to make it better? we will take the test and generate one using magicslides.app Design My PPT
Icon 1
Icon 2
PDF to JPGConvert PDF to high-quality JPG images online. Useful for archiving or sharing presentations visually. Create JPG from PDF