Пример #1
0
        public virtual void calc1Screen(Point3f center, Vector3f vector, short mad, float offsetFraction, Point3i screen)
        {
            pointT.set_Renamed(vector);
            float scale = mad * offsetFraction;

            pointT.scaleAdd(scale, center);
            //viewer.transformPoint(pointT, screen);
        }
Пример #2
0
 public virtual void getLeadMidPoint(int groupIndex, Point3f midPoint)
 {
     if (groupIndex == monomerCount)
     {
         --groupIndex;
     }
     else if (groupIndex > 0)
     {
         midPoint.set_Renamed(getLeadPoint(groupIndex));
         midPoint.add(getLeadPoint(groupIndex - 1));
         midPoint.scale(0.5f);
         return;
     }
     midPoint.set_Renamed(getLeadPoint(groupIndex));
 }
Пример #3
0
 public virtual Point3i[] calcScreens(Point3f[] centers, Vector3f[] vectors, short[] mads, float offsetFraction)
 {
     // this basically does object->screen transformation??
     Point3i[] screens = new Point3i[centers.Length];// viewer.allocTempScreens(centers.Length);
     if (offsetFraction == 0)
     {
         for (int i = centers.Length; --i >= 0;)
         {
             screens[i] = new Point3i((int)centers[i].x, (int)centers[i].y, (int)centers[i].z);
         }
         //viewer.transformPoint(centers[i], screens[i]);
     }
     else
     {
         offsetFraction /= 1000;
         for (int i = centers.Length; --i >= 0;)
         {
             pointT.set_Renamed(vectors[i]);
             float scale = mads[i] * offsetFraction;
             pointT.scaleAdd(scale, centers[i]);
             //if (float.IsNaN(pointT.x))
             //{
             //    System.Console.Out.WriteLine(" vectors[" + i + "]=" + vectors[i] + " centers[" + i + "]=" + centers[i] + " mads[" + i + "]=" + mads[i] + " scale=" + scale + " --> " + pointT);
             //}
             //viewer.transformPoint(pointT, screens[i]);
             screens[i] = new Point3i((int)pointT.x, (int)pointT.y, (int)pointT.z);
         }
     }
     return(screens);
 }
Пример #4
0
        public virtual void projectOntoAxis(Point3f point)
        {
            // assumes axisA, axisB, and axisUnitVector are set;
            vectorProjection.sub(point, axisA);
            float projectedLength = vectorProjection.dot(axisUnitVector);

            point.set_Renamed(axisUnitVector);
            point.scaleAdd(projectedLength, axisA);
        }
Пример #5
0
        public virtual void renderAngle(Atom atomA, Atom atomB, Atom atomC, short colix, bool renderArcs)
        {
            /*
             * if (! (atomA.isVisible() && atomB.isVisible() && atomC.isVisible()))
             * return;
             */
            if (displayModelIndex >= 0 && (displayModelIndex != atomA.modelIndex || displayModelIndex != atomB.modelIndex || displayModelIndex != atomC.modelIndex))
            {
                return;
            }
            //g3d.setColix(colix);
            int zA      = atomA.ScreenZ - atomA.ScreenD - 10;
            int zB      = atomB.ScreenZ - atomB.ScreenD - 10;
            int zC      = atomC.ScreenZ - atomC.ScreenD - 10;
            int zOffset = (zA + zB + zC) / 3;
            int radius  = drawSegment(atomA.ScreenX, atomA.ScreenY, zA, atomB.ScreenX, atomB.ScreenY, zB, colix);

            radius += drawSegment(atomB.ScreenX, atomB.ScreenY, zB, atomC.ScreenX, atomC.ScreenY, zC, colix);
            radius  = (radius + 1) / 2;

            if (!renderArcs)
            {
                return;
            }


            // FIXME mth -- this really should be a function of pixelsPerAngstrom
            // in addition, the location of the arc is not correct
            // should probably be some percentage of the smaller distance
            AxisAngle4f aa = measurement.aa;

            if (aa == null)
            {
                // 180 degrees
                paintMeasurementString(atomB.ScreenX + 5, atomB.ScreenY - 5, zB, radius, colix);
                return;
            }
            int   dotCount  = (int)((aa.angle / (2 * System.Math.PI)) * 64);
            float stepAngle = aa.angle / dotCount;

            aaT.set_Renamed(aa);
            int iMid = dotCount / 2;

            for (int i = dotCount; --i >= 0;)
            {
                aaT.angle = i * stepAngle;
                matrixT.set_Renamed(aaT);
                pointT.set_Renamed(measurement.pointArc);
                matrixT.transform(pointT);
                pointT.add(atomB.point3f);
                //Point3i screenArc = viewer.transformPoint(pointT);
                //int zArc = screenArc.z - zOffset;
                //if (zArc < 0)
                //    zArc = 0;
                //g3d.drawPixel(screenArc.x, screenArc.y, zArc);
                //if (i == iMid)
                //{
                //    pointT.set_Renamed(measurement.pointArc);
                //    pointT.scale(1.1f);
                //    matrixT.transform(pointT);
                //    pointT.add(atomB.point3f);
                //    Point3i screenLabel = viewer.transformPoint(pointT);
                //    int zLabel = screenLabel.z - zOffset;
                //    paintMeasurementString(screenLabel.x, screenLabel.y, zLabel, radius, colix);
                //}
            }
        }