diff --git a/src/mol-geo/primitive/box.ts b/src/mol-geo/primitive/box.ts index 990730641206701eda7102ee6e4fb8441398dd95..d3fa7f74dd3bf158dd0756d2101aca4921e66931 100644 --- a/src/mol-geo/primitive/box.ts +++ b/src/mol-geo/primitive/box.ts @@ -33,8 +33,8 @@ function createBox(perforated: boolean): Primitive { Vec3.set(b, points[2], points[3], -0.5) Vec3.set(c, points[4], points[5], -0.5) Vec3.set(d, points[6], points[7], -0.5) - builder.add(a, b, c) - if (!perforated) builder.add(c, d, a) + builder.add(c, b, a) + if (!perforated) builder.add(a, d, c) Vec3.set(a, points[0], points[1], 0.5) Vec3.set(b, points[2], points[3], 0.5) Vec3.set(c, points[4], points[5], 0.5) diff --git a/src/mol-geo/primitive/prism.ts b/src/mol-geo/primitive/prism.ts index d7ad601033b04cd4429ae07d725dc2ba57e5beef..02bbee0b26176c27c36d6502cd83523fba8b3ace 100644 --- a/src/mol-geo/primitive/prism.ts +++ b/src/mol-geo/primitive/prism.ts @@ -16,7 +16,7 @@ const a = Vec3.zero(), b = Vec3.zero(), c = Vec3.zero(), d = Vec3.zero() */ export function Prism(points: ArrayLike<number>): Primitive { const sideCount = points.length / 2 - if (sideCount < 5) throw new Error('need at least 5 points to build a prism') + if (sideCount < 4) throw new Error('need at least 5 points to build a prism') const count = 4 * sideCount const builder = PrimitiveBuilder(count) @@ -37,10 +37,10 @@ export function Prism(points: ArrayLike<number>): Primitive { const ni = (i + 1) % sideCount Vec3.set(a, points[i * 2], points[i * 2 + 1], -0.5) Vec3.set(b, points[ni * 2], points[ni * 2 + 1], -0.5) - builder.add(a, b, on) + builder.add(on, b, a) Vec3.set(a, points[i * 2], points[i * 2 + 1], 0.5) Vec3.set(b, points[ni * 2], points[ni * 2 + 1], 0.5) - builder.add(op, b, a) + builder.add(a, b, op) } return builder.getPrimitive() diff --git a/src/mol-geo/primitive/pyramid.ts b/src/mol-geo/primitive/pyramid.ts index f865a923658eec18d9bd29d2729ec31edca8cc24..95c80197eeea63751a76c87fc6749d56d8f9e710 100644 --- a/src/mol-geo/primitive/pyramid.ts +++ b/src/mol-geo/primitive/pyramid.ts @@ -33,20 +33,20 @@ export function Pyramide(points: ArrayLike<number>): Primitive { Vec3.set(a, points[0], points[1], -0.5) Vec3.set(b, points[2], points[3], -0.5) Vec3.set(c, points[4], points[5], -0.5) - builder.add(a, b, c) + builder.add(c, b, a) } else if (sideCount === 4) { Vec3.set(a, points[0], points[1], -0.5) Vec3.set(b, points[2], points[3], -0.5) Vec3.set(c, points[4], points[5], -0.5) Vec3.set(d, points[6], points[7], -0.5) - builder.add(a, b, c) - builder.add(c, d, a) + builder.add(c, b, a) + builder.add(a, d, c) } else { for (let i = 0; i < sideCount; ++i) { const ni = (i + 1) % sideCount Vec3.set(a, points[i * 2], points[i * 2 + 1], -0.5) Vec3.set(b, points[ni * 2], points[ni * 2 + 1], -0.5) - builder.add(a, b, on) + builder.add(on, b, a) } } diff --git a/src/mol-geo/primitive/star.ts b/src/mol-geo/primitive/star.ts index f24ac248bfe1e48276434564a695364ad909a413..2cb94620c3d450b47f58fb57422a221bc9b2839d 100644 --- a/src/mol-geo/primitive/star.ts +++ b/src/mol-geo/primitive/star.ts @@ -46,9 +46,9 @@ export function Star(props?: StarProps): Primitive { Vec3.set(c, outerPoints[ni * 2], outerPoints[ni * 2 + 1], 0) builder.add(op, a, b) - builder.add(on, a, b) + builder.add(b, a, on) builder.add(op, b, c) - builder.add(on, b, c) + builder.add(c, b, on) } return builder.getPrimitive() diff --git a/src/mol-geo/primitive/wedge.ts b/src/mol-geo/primitive/wedge.ts index 3b2d317b9e3575e1aaf527e3697638692179c648..cfd912b53533d0b1283af25f257d3d72c88a8030 100644 --- a/src/mol-geo/primitive/wedge.ts +++ b/src/mol-geo/primitive/wedge.ts @@ -32,11 +32,11 @@ export function createWedge(): Primitive { Vec3.set(a, points[0], points[1], -0.5) Vec3.set(b, points[2], points[3], -0.5) Vec3.set(c, points[4], points[5], -0.5) - builder.add(a, b, c) + builder.add(c, b, a) Vec3.set(a, points[0], points[1], 0.5) Vec3.set(b, points[2], points[3], 0.5) Vec3.set(c, points[4], points[5], 0.5) - builder.add(c, b, a) + builder.add(a, b, c) return builder.getPrimitive() }