-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't generate tube or line #9
Comments
I have the same use case and I am experiencing the same issue of my created entities being invisible. extension RealityGeometry {
/// Create a new torus arc MeshResource 🍩
/// - Parameters:
/// - sides: Number of segments in the toroidal direction (outer edge of the torus).
/// - csSides: Number of segments in the poloidal direction (segments in the tube)
/// - radius: Distance from the centre of the torus to the centre of the tube.
/// - csRadius: Radius of the tube.
/// - startDegrees: The starting angle of the arc
/// - endDegrees: The ending angle of the arc
/// - Returns: A new torus `MeshResource`
public static func generateTorusArc(
sides: Int, csSides: Int, radius: Float, csRadius: Float, startDegrees: Float, endDegrees: Float
) throws -> MeshResource {
// Build a series of points that will serve to build a tube around
let angleIncs = 360.0 / Float(sides)
let dToR: Float = .pi / 180
let radIncs = angleIncs * dToR
let startRads: Float = startDegrees * dToR
let endRads: Float = endDegrees * dToR
let ptRadius = (csRadius + radius)
var i = startRads
let z: Float = 0.0
var x: Float
var y: Float
var points: [SIMD3<Float>] = []
while i < endRads {
var point = SIMD3(x: cosf(i) * ptRadius, y: cosf(i) * ptRadius, z: z)
points.append(point)
i += radIncs
}
var results = try generateTube(points: points, radius: csRadius, edges: csSides)
return results
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello 👋🏻
I am trying to build a sort of circle arc, or torus section, using the provided line and tube methods. Here is my sample code:
The code runs with no errors and manages to go over the guard line. However, using line or generateTube does not produce any visible entity. Interesting fact: using generatePath with the same points does produce the correct mesh, but path is flat and I need a proper 3D tube-like object.
BTW thank you for this package, it's helping me a lot with my non-existent 3D development skills.
The text was updated successfully, but these errors were encountered: