Package jpbrt.core

Examples of jpbrt.core.Point


    }

    @Override
    public BBox objectBound()
    {
        return new BBox( new Point(-radius, -radius, zmin),
                         new Point(radius, radius, zmax) );
    }
View Full Code Here


            if (thit > ray.maxt)
                return result;
        }
       
        // compute sphere hit position and phi
        Point phit = ray.eval(thit);
        if (phit.x == 0.0 && phit.y == 0.0)
            phit.x = 1e-5 * radius;
        double phi = Math.atan2(phit.y, phit.x);
        if (phi < 0.0)
            phi += 2 * Math.PI;
 
View Full Code Here

            if (thit > ray.maxt)
                return false;
        }
       
        // compute sphere hit position and phi
        Point phit = ray.eval(thit);
        if (phit.x == 0.0 && phit.y == 0.0)
            phit.x = 1e-5 * radius;
        double phi = Math.atan2(phit.y, phit.x);
        if (phi < 0.0)
            phi += 2 * Math.PI;
 
View Full Code Here

    }

    @Override
    public BBox objectBound()
    {
        Point p1 = mesh.p[v1];
        Point p2 = mesh.p[v2];
        Point p3 = mesh.p[v3];
        BBox bbox = new BBox( worldToObject.transform(p1), worldToObject.transform(p2) );
        return bbox.unionLocal( worldToObject.transform(p3) );
    }
View Full Code Here

    }

    @Override
    public BBox worldBound()
    {
        Point p1 = mesh.p[v1];
        Point p2 = mesh.p[v2];
        Point p3 = mesh.p[v3];
        BBox bbox = new BBox(p1, p2);
        return bbox.unionLocal(p3);
    }
View Full Code Here

    public Intersection intersect(Ray ray)
    {
        Intersection result = new Intersection();
       
        // compute s1 = d x e2
        Point p1 = mesh.p[v1];
        Point p2 = mesh.p[v2];
        Point p3 = mesh.p[v3];
        Vector e1 = p1.to(p2);
        Vector e2 = p1.to(p3);
        Vector s1 = ray.d.cross(e2);
        double divisor = s1.dot(e1);
        if (divisor == 0)
            return result;
        double invDivisor = 1.0 / divisor;
       
        // compute first barycentric coordinate b1
        Vector d = p1.to(ray.o);
        double b1 = d.dot(s1) * invDivisor;
        if (b1 < 0 || b1 > 1)
            return result;
       
        // compute second barycentric coordinate b2
        Vector s2 = d.cross(e1);
        double b2 = ray.d.dot(s2) * invDivisor;
        if (b2 < 0 || b2 > 1)
            return result;
       
        // compute t to intersection point
        double t = e2.dot(s2) * invDivisor;
        if (t < ray.mint || t > ray.maxt)
            return result;
       
        // compute triangle partial derivatives
        Vector dpdu, dpdv;
        double[][] uvs = getUVs();
       
        // compute deltas for triangle partial derivatives
        double du1 = uvs[0][0] - uvs[2][0];
        double du2 = uvs[1][0] - uvs[2][0];
        double dv1 = uvs[0][1] - uvs[2][1];
        double dv2 = uvs[1][1] - uvs[2][1];
        Vector dp1 = p3.to(p1);
        Vector dp2 = p3.to(p2);
       
        double determinant = du1 * dv2 - dv1 * du2;
        if (determinant == 0)
        {
            dpdu = new Vector();
View Full Code Here

    }
   
    @Override
    public double area()
    {
        Point p1 = mesh.p[v1];
        Point p2 = mesh.p[v2];
        Point p3 = mesh.p[v3];
        Vector v1 = p1.to(p2);
        Vector v2 = p1.to(p3);
        return 0.5 * v1.cross(v2).length();
    }
View Full Code Here

TOP

Related Classes of jpbrt.core.Point

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.