{"ast":null,"code":"import { Vector3 } from \"../../Maths/math.vector.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { CreateRibbon } from \"./ribbonBuilder.js\";\n/**\n * Creates lathe mesh.\n * The lathe is a shape with a symmetry axis : a 2D model shape is rotated around this axis to design the lathe\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\n * * The parameter `radius` (positive float, default 1) is the radius value of the lathe\n * * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe\n * * The parameter `clip` (positive integer, default 0) is the number of sides to not create without effecting the general shape of the sides\n * * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape\n * * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter \"arc\"\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param scene defines the hosting scene\n * @returns the lathe mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#lathe\n */\nexport function CreateLathe(name, options, scene = null) {\n const arc = options.arc ? options.arc <= 0 || options.arc > 1 ? 1.0 : options.arc : 1.0;\n const closed = options.closed === undefined ? true : options.closed;\n const shape = options.shape;\n const radius = options.radius || 1;\n const tessellation = options.tessellation || 64;\n const clip = options.clip || 0;\n const updatable = options.updatable;\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n const cap = options.cap || Mesh.NO_CAP;\n const pi2 = Math.PI * 2;\n const paths = [];\n const invertUV = options.invertUV || false;\n let i = 0;\n let p = 0;\n const step = pi2 / tessellation * arc;\n let rotated;\n let path;\n for (i = 0; i <= tessellation - clip; i++) {\n path = [];\n if (cap == Mesh.CAP_START || cap == Mesh.CAP_ALL) {\n path.push(new Vector3(0, shape[0].y, 0));\n path.push(new Vector3(Math.cos(i * step) * shape[0].x * radius, shape[0].y, Math.sin(i * step) * shape[0].x * radius));\n }\n for (p = 0; p < shape.length; p++) {\n rotated = new Vector3(Math.cos(i * step) * shape[p].x * radius, shape[p].y, Math.sin(i * step) * shape[p].x * radius);\n path.push(rotated);\n }\n if (cap == Mesh.CAP_END || cap == Mesh.CAP_ALL) {\n path.push(new Vector3(Math.cos(i * step) * shape[shape.length - 1].x * radius, shape[shape.length - 1].y, Math.sin(i * step) * shape[shape.length - 1].x * radius));\n path.push(new Vector3(0, shape[shape.length - 1].y, 0));\n }\n paths.push(path);\n }\n // lathe ribbon\n const lathe = CreateRibbon(name, {\n pathArray: paths,\n closeArray: closed,\n sideOrientation: sideOrientation,\n updatable: updatable,\n invertUV: invertUV,\n frontUVs: options.frontUVs,\n backUVs: options.backUVs\n }, scene);\n return lathe;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use the function direction from the module\n */\nexport const LatheBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateLathe\n};\nMesh.CreateLathe = (name, shape, radius, tessellation, scene, updatable, sideOrientation) => {\n const options = {\n shape: shape,\n radius: radius,\n tessellation: tessellation,\n sideOrientation: sideOrientation,\n updatable: updatable\n };\n return CreateLathe(name, options, scene);\n};","map":{"version":3,"names":["Vector3","Mesh","CreateRibbon","CreateLathe","name","options","scene","arc","closed","undefined","shape","radius","tessellation","clip","updatable","sideOrientation","_GetDefaultSideOrientation","cap","NO_CAP","pi2","Math","PI","paths","invertUV","i","p","step","rotated","path","CAP_START","CAP_ALL","push","y","cos","x","sin","length","CAP_END","lathe","pathArray","closeArray","frontUVs","backUVs","LatheBuilder"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Builders/latheBuilder.js"],"sourcesContent":["import { Vector3 } from \"../../Maths/math.vector.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { CreateRibbon } from \"./ribbonBuilder.js\";\n/**\n * Creates lathe mesh.\n * The lathe is a shape with a symmetry axis : a 2D model shape is rotated around this axis to design the lathe\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\n * * The parameter `radius` (positive float, default 1) is the radius value of the lathe\n * * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe\n * * The parameter `clip` (positive integer, default 0) is the number of sides to not create without effecting the general shape of the sides\n * * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape\n * * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter \"arc\"\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param scene defines the hosting scene\n * @returns the lathe mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#lathe\n */\nexport function CreateLathe(name, options, scene = null) {\n const arc = options.arc ? (options.arc <= 0 || options.arc > 1 ? 1.0 : options.arc) : 1.0;\n const closed = options.closed === undefined ? true : options.closed;\n const shape = options.shape;\n const radius = options.radius || 1;\n const tessellation = options.tessellation || 64;\n const clip = options.clip || 0;\n const updatable = options.updatable;\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n const cap = options.cap || Mesh.NO_CAP;\n const pi2 = Math.PI * 2;\n const paths = [];\n const invertUV = options.invertUV || false;\n let i = 0;\n let p = 0;\n const step = (pi2 / tessellation) * arc;\n let rotated;\n let path;\n for (i = 0; i <= tessellation - clip; i++) {\n path = [];\n if (cap == Mesh.CAP_START || cap == Mesh.CAP_ALL) {\n path.push(new Vector3(0, shape[0].y, 0));\n path.push(new Vector3(Math.cos(i * step) * shape[0].x * radius, shape[0].y, Math.sin(i * step) * shape[0].x * radius));\n }\n for (p = 0; p < shape.length; p++) {\n rotated = new Vector3(Math.cos(i * step) * shape[p].x * radius, shape[p].y, Math.sin(i * step) * shape[p].x * radius);\n path.push(rotated);\n }\n if (cap == Mesh.CAP_END || cap == Mesh.CAP_ALL) {\n path.push(new Vector3(Math.cos(i * step) * shape[shape.length - 1].x * radius, shape[shape.length - 1].y, Math.sin(i * step) * shape[shape.length - 1].x * radius));\n path.push(new Vector3(0, shape[shape.length - 1].y, 0));\n }\n paths.push(path);\n }\n // lathe ribbon\n const lathe = CreateRibbon(name, { pathArray: paths, closeArray: closed, sideOrientation: sideOrientation, updatable: updatable, invertUV: invertUV, frontUVs: options.frontUVs, backUVs: options.backUVs }, scene);\n return lathe;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use the function direction from the module\n */\nexport const LatheBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateLathe,\n};\nMesh.CreateLathe = (name, shape, radius, tessellation, scene, updatable, sideOrientation) => {\n const options = {\n shape: shape,\n radius: radius,\n tessellation: tessellation,\n sideOrientation: sideOrientation,\n updatable: updatable,\n };\n return CreateLathe(name, options, scene);\n};\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,4BAA4B;AACpD,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,YAAY,QAAQ,oBAAoB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAACC,IAAI,EAAEC,OAAO,EAAEC,KAAK,GAAG,IAAI,EAAE;EACrD,MAAMC,GAAG,GAAGF,OAAO,CAACE,GAAG,GAAIF,OAAO,CAACE,GAAG,IAAI,CAAC,IAAIF,OAAO,CAACE,GAAG,GAAG,CAAC,GAAG,GAAG,GAAGF,OAAO,CAACE,GAAG,GAAI,GAAG;EACzF,MAAMC,MAAM,GAAGH,OAAO,CAACG,MAAM,KAAKC,SAAS,GAAG,IAAI,GAAGJ,OAAO,CAACG,MAAM;EACnE,MAAME,KAAK,GAAGL,OAAO,CAACK,KAAK;EAC3B,MAAMC,MAAM,GAAGN,OAAO,CAACM,MAAM,IAAI,CAAC;EAClC,MAAMC,YAAY,GAAGP,OAAO,CAACO,YAAY,IAAI,EAAE;EAC/C,MAAMC,IAAI,GAAGR,OAAO,CAACQ,IAAI,IAAI,CAAC;EAC9B,MAAMC,SAAS,GAAGT,OAAO,CAACS,SAAS;EACnC,MAAMC,eAAe,GAAGd,IAAI,CAACe,0BAA0B,CAACX,OAAO,CAACU,eAAe,CAAC;EAChF,MAAME,GAAG,GAAGZ,OAAO,CAACY,GAAG,IAAIhB,IAAI,CAACiB,MAAM;EACtC,MAAMC,GAAG,GAAGC,IAAI,CAACC,EA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