diff --git a/src/mol-geo/primitive/polygon.ts b/src/mol-geo/primitive/polygon.ts index 83ff7c8c0da766f3ad7176fc57e81085e4f93744..b7db9972eb6511dc1cab248e47c658594985bb8d 100644 --- a/src/mol-geo/primitive/polygon.ts +++ b/src/mol-geo/primitive/polygon.ts @@ -12,7 +12,7 @@ export function polygon(sideCount: number, shift: boolean) { const points = new Float32Array(sideCount * 2) const radius = sideCount <= 4 ? Math.sqrt(2) / 2 : 0.6 - const offset = shift ? 0 : 1 + const offset = shift ? 1 : 0 for (let i = 0, il = 2 * sideCount; i < il; i += 2) { const c = (i + offset) / sideCount * Math.PI diff --git a/src/mol-geo/primitive/prism.ts b/src/mol-geo/primitive/prism.ts index 445ceed901872f4320f646621fa62fbe45353cf7..728d18404141229dd10e5cf063fc0b61e6711ac0 100644 --- a/src/mol-geo/primitive/prism.ts +++ b/src/mol-geo/primitive/prism.ts @@ -78,7 +78,7 @@ export function Wedge() { let box: Primitive export function Box() { - if (!box) box = Prism(polygon(4, false)) + if (!box) box = Prism(polygon(4, true)) return box } @@ -88,14 +88,14 @@ export function DiamondPrism() { return diamond } -let hexagonalPrism: Primitive -export function HexagonalPrism() { - if (!hexagonalPrism) hexagonalPrism = Prism(polygon(5, false)) - return hexagonalPrism -} - let pentagonalPrism: Primitive export function PentagonalPrism() { - if (!pentagonalPrism) pentagonalPrism = Prism(polygon(6, true)) + if (!pentagonalPrism) pentagonalPrism = Prism(polygon(5, false)) return pentagonalPrism +} + +let hexagonalPrism: Primitive +export function HexagonalPrism() { + if (!hexagonalPrism) hexagonalPrism = Prism(polygon(6, true)) + return hexagonalPrism } \ No newline at end of file diff --git a/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts b/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts index 265e32e7897df348245d86e4ca894099f53b3673..70f363b02d7ba89d6b89be54e26e9ef7d0e61d4b 100644 --- a/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts +++ b/src/mol-geo/representation/structure/visual/carbohydrate-symbol-mesh.ts @@ -83,44 +83,45 @@ async function createCarbohydrateSymbolMesh(ctx: RuntimeContext, structure: Stru break case SaccharideShapes.FlatBox: centerAlign(cGeo.center, cGeo.normal, cGeo.direction) - Mat4.mul(t, t, Mat4.rotY90) + Mat4.mul(t, t, Mat4.rotZY90) Mat4.scale(t, t, Vec3.set(sVec, side, side, side / 2)) builder.addBox(t) break case SaccharideShapes.FilledStar: centerAlign(cGeo.center, cGeo.normal, cGeo.direction) - Mat4.mul(t, t, Mat4.rotY90) + Mat4.mul(t, t, Mat4.rotZY90) builder.addStar(t, { outerRadius: side, innerRadius: side / 2, thickness: side / 2, pointCount: 5 }) break case SaccharideShapes.FilledDiamond: centerAlign(cGeo.center, cGeo.normal, cGeo.direction) - Mat4.mul(t, t, Mat4.rotY90) + Mat4.mul(t, t, Mat4.rotZY90) Mat4.scale(t, t, Vec3.set(sVec, side * 1.4, side * 1.4, side * 1.4)) builder.addOctahedron(t) break case SaccharideShapes.DividedDiamond: // TODO split centerAlign(cGeo.center, cGeo.normal, cGeo.direction) - Mat4.mul(t, t, Mat4.rotY90) + Mat4.mul(t, t, Mat4.rotZY90) Mat4.scale(t, t, Vec3.set(sVec, side * 1.4, side * 1.4, side * 1.4)) builder.addOctahedron(t) break case SaccharideShapes.FlatDiamond: centerAlign(cGeo.center, cGeo.normal, cGeo.direction) - Mat4.mul(t, t, Mat4.rotY90) + Mat4.mul(t, t, Mat4.rotZY90) Mat4.scale(t, t, Vec3.set(sVec, side, side / 2, side / 2)) builder.addDiamondPrism(t) + break case SaccharideShapes.Pentagon: centerAlign(cGeo.center, cGeo.normal, cGeo.direction) - Mat4.mul(t, t, Mat4.rotY90) + Mat4.mul(t, t, Mat4.rotZY90) Mat4.scale(t, t, Vec3.set(sVec, side, side, side / 2)) builder.addPentagonalPrism(t) break case SaccharideShapes.FlatHexagon: default: centerAlign(cGeo.center, cGeo.normal, cGeo.direction) - Mat4.mul(t, t, Mat4.rotY90) - Mat4.scale(t, t, Vec3.set(sVec, side, side, side / 2)) + Mat4.mul(t, t, Mat4.rotZYZ90) + Mat4.scale(t, t, Vec3.set(sVec, side / 1.5, side , side / 2)) builder.addHexagonalPrism(t) break } diff --git a/src/mol-math/linear-algebra/3d/mat4.ts b/src/mol-math/linear-algebra/3d/mat4.ts index dd56c80e624ba93813ab5949cf40cb2895dc75e9..ddd7eaafd42725f55018bfdbd35f4185b581a9af 100644 --- a/src/mol-math/linear-algebra/3d/mat4.ts +++ b/src/mol-math/linear-algebra/3d/mat4.ts @@ -877,8 +877,14 @@ namespace Mat4 { export const rotX90: ReadonlyMat4 = Mat4.fromRotation(Mat4.identity(), degToRad(90), Vec3.create(1, 0, 0)) /** Rotation matrix for 90deg rotation around y-axis */ export const rotY90: ReadonlyMat4 = Mat4.fromRotation(Mat4.identity(), degToRad(90), Vec3.create(0, 1, 0)) + /** Rotation matrix for 90deg rotation around z-axis */ + export const rotZ90: ReadonlyMat4 = Mat4.fromRotation(Mat4.identity(), degToRad(90), Vec3.create(0, 0, 1)) /** Rotation matrix for 90deg rotation around first x-axis and then y-axis */ export const rotXY90: ReadonlyMat4 = Mat4.mul(Mat4.identity(), rotX90, rotY90) + /** Rotation matrix for 90deg rotation around first z-axis and then y-axis */ + export const rotZY90: ReadonlyMat4 = Mat4.mul(Mat4.identity(), rotZ90, rotY90) + /** Rotation matrix for 90deg rotation around first z-axis and then y-axis and then z-axis */ + export const rotZYZ90: ReadonlyMat4 = Mat4.mul(Mat4.identity(), rotZY90, rotZ90) } export default Mat4 \ No newline at end of file diff --git a/src/mol-view/stage.ts b/src/mol-view/stage.ts index b806d5407083f99be48362a139c4f1766f0a231b..5ebbbb2db4339e8a7b4d2b8c4af9ecc39f436d6b 100644 --- a/src/mol-view/stage.ts +++ b/src/mol-view/stage.ts @@ -98,14 +98,14 @@ export class Stage { // this.loadPdbid('3sn6') // discontinuous chains // this.loadPdbid('2zex') // contains carbohydrate polymer // this.loadPdbid('3sgj') // contains carbohydrate polymer - this.loadPdbid('3ina') // contains GlcN and IdoA + // this.loadPdbid('3ina') // contains GlcN and IdoA // this.loadPdbid('1umz') // contains Xyl (Xyloglucan) // this.loadPdbid('1mfb') // contains Abe // this.loadPdbid('2gdu') // contains sucrose // this.loadPdbid('2fnc') // contains maltotriose // this.loadPdbid('4zs9') // contains raffinose // this.loadPdbid('2yft') // contains kestose - // this.loadPdbid('2b5t') // contains large carbohydrate polymer + this.loadPdbid('2b5t') // contains large carbohydrate polymer // this.loadMmcifUrl(`../../examples/1cbs_full.bcif`) // this.loadMmcifUrl(`../../examples/1cbs_updated.cif`) // this.loadMmcifUrl(`../../examples/1crn.cif`)