{"id":"stravant/geometry","name":"geometry","scope":"stravant","platform":"roblox","description":"A geometry module with the getGeometry and blackboxFindClosestMeshEdge functions.","version":"0.1.3","latest":"0.1.3","versions":["0.1.0","0.1.2","0.1.3"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"c792de5e359617f6de5da44cba053e015b3b2e1ca74310d283a150420500724b","likes":0,"downloads":0,"install":"forest install stravant/geometry","url":"https://forest.dev/p/roblox/stravant/geometry","files":"https://api.forest.dev/ai/package/roblox/stravant/geometry/files","readme":"# Roblox Geometry Module\nThis is a module which contains two important geometry functions for Roblox tooling.\n\n## getGeometry\n\nThis is a function which returns a detailed mesh representation of the geometry of a Roblox primitive. That is, one of the five primitive types between a Box, WedgePart, CornerWedgePart, Sphere, or Cylinder. It contains all the logic to decide which of those geometries is appropriate for a given BasePart.\n\nYou can optionally pass a CFrame as the third argument to get the geometry assuming that the part were at that CFrame rather than where it currently is. Note: Passing `CFrame.identity` here will effectively give you the geometry in the local space of the object rather than in world space like it is normally given.\n\nThe id on each element is a stable id from invocation to invocation allowing you to track the same element across multiple invocations.\n\nThe vertexMargin / edgeMargin are the minimum amount of \"safe\" space perpendicular to the feature, and can be used to determine a reasonable sizing of visualizations around the feature.\n\nThe data is returned in the following format:\n```luau\ntype GeometryVertex = {\n\tid: number,\n\tposition: Vector3,\n\ttype: \"Vertex\",\n}\n\ntype GeometryEdge = {\n\tid: number,\n\ta: Vector3,\n\tb: Vector3,\n\tdirection: UnitVector3,\n\tlength: number,\n\tedgeMargin: number,\n\tvertexMargin: number,\n\tpart: BasePart,\n\ttype: \"Edge\",\n}\n\ntype SurfaceType = \"BottomSurface\" | \"TopSurface\" | \"LeftSurface\" | \"RightSurface\" | \"FrontSurface\" | \"BackSurface\"\n\ntype GeometryFace = {\n\tid: number,\n\tpoint: Vector3,\n\tnormal: UnitVector3,\n\tsurface: SurfaceType,\n\tdirection: UnitVector3,\n\tvertices: {Vector3},\n\tpart: BasePart,\n\ttype: \"Face\",\n}\n\ntype GeometryResult = {\n\tpart: BasePart,\n\tshape: \"Sphere\" | \"Cylinder\" | \"Mesh\",\n\tvertices: {GeometryVertex},\n\tedges: {GeometryEdge},\n\tfaces: {GeometryFace},\n\tvertexMargin: number,\n}\n```\n\n## blackboxFindClosestMeshEdge\n\nFor mouse hit in the form of a RaycastResult, find the edge closest to that hit. The edge is returned in the same `GeometryEdge` format as edges in the table returned by getGeometry. The function may be used for hits against primitive parts, but keep in mind that it will never return a result for Spheres / Cylinders since there aren't any straight edges to find.\n\nThe function operates by using up to 50 raycasts to inspect the geometry around the hit and then working out exactly where the edge must be analytically from that information. This means it comes at a significant perforance cost, and will run fine for tooling purposes, but should not be used in live experiences for gameplay purposes.\n","readmeTruncated":false}