Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#682 closed defect (fixed)

cone geometry

Reported by: Tristan Croll Owned by: Tom Goddard
Priority: minor Milestone:
Component: Core Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Trivial thing really. In chimerax.core.surface.shapes, line 190, the normals for the cone base are pointing in the wrong direction. The line should read:

        narray[nc2:] = (0,0,1) if points_up else (0,0,-1)

Oh, and the docstring for the cone_geometry function needs updating. It's no longer true that the point of the cone is at the origin - the origin is halfway along the cone axis.

Attachments (1)

image3.png (10.8 KB ) - added by Tristan Croll 8 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Tom Goddard, 8 years ago

Resolution: not a bug
Status: assignedclosed

The original code looks correct to me. It is setting the normal vector for the base end cap of the cone. If the cone points up, then the base normal points down (0,0,-1). Also I use this for VR and I believe it is correctly lit. Let me know if I am missing something.

comment:2 by Tristan Croll, 8 years ago

On my machine, with a cone generated using the existing code the base is dark and out of step with the surroundings when facing the camera. When I flip the normal, it comes out looking bright. Will check again more closely today.

by Tristan Croll, 8 years ago

Attachment: image3.png added

comment:3 by Tristan Croll, 8 years ago

If I change cone_geometry to read:

def cone_geometry(radius = 1, height = 1, nc = 20, caps = True, points_up = True, flipped_normal = False):
   ...
        if flipped_normal:
            narray[nc2:] = (0,0,1) if points_up else (0,0,-1)
        else:
            narray[nc2:] = (0,0,-1) if points_up else (0,0,1)

... then the attached image has the result of flipped_normal = True on the right, False on the left, and a standard sphere in the middle for comparison.

comment:4 by Tom Goddard, 8 years ago

Resolution: not a bug
Status: closedreopened

Fixed.

The problem was that the cone base triangles had the wrong vertex order (needs to be counter-clockwise when looked at the outside face of the triangle).

comment:5 by Tom Goddard, 8 years ago

Resolution: fixed
Status: reopenedclosed

comment:6 by Eric Pettersen, 8 years ago

Component: UnassignedCore
Note: See TracTickets for help on using tickets.