当前位置: 首页>>代码示例>>Java>>正文


Java Point2D类代码示例

本文整理汇总了Java中com.theeyetribe.clientsdk.data.Point2D的典型用法代码示例。如果您正苦于以下问题:Java Point2D类的具体用法?Java Point2D怎么用?Java Point2D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Point2D类属于com.theeyetribe.clientsdk.data包,在下文中一共展示了Point2D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resampleCalibration

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
public void resampleCalibration(List<Point2D> anchors)
{
    if(null != anchors)
    {
        this.mAnchors = anchors;
        for (Point2D anchor : anchors)
        {
            if (hasPointBeenResampled(anchor) == false)
            {
                mPointsResampled.add(anchor);
            }
            else
            {
                Point2D adjustedPoint = adjustPointForResampling(anchor);
                mPointsResampled.add(adjustedPoint);
                anchor.x = adjustedPoint.x;
                anchor.y = adjustedPoint.y;
            }
        }

        mCalibrationSequence.stop();
        mCalibrationSequence = initAnimations(instruct, calibPoint, anchors, true);
        mCalibrationSequence.play();
    }
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:26,代码来源:SceneCalibrationController.java

示例2: hasPointBeenResampled

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
private boolean hasPointBeenResampled(Point2D calPoint)
{
    if (mPointsResampled == null)
    {
        mPointsResampled = new ArrayList<Point2D>();
        return false;
    }

    for(Point2D ct : mPointsResampled)
    {
        if(ct.equals(calPoint))
            return true;
    }

    return false;
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:17,代码来源:SceneCalibrationController.java

示例3: updateEye

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
private void updateEye(Pane root, ImageView eyeImageView, GazeData.Eye eye, double angle, double scale)
{
    Point2D p = GazeUtils.getRelativeToRect(
            eye.pupilCenterCoordinates,
            (int) Math.round(root.getScene().getWidth()),
            (int) Math.round(root.getScene().getHeight())
    );

    p.x -= eyeImageView.getFitWidth() * .5d;
    p.y -= eyeImageView.getFitHeight() * .5d;

    eyeImageView.setX(p.x);
    eyeImageView.setY(p.y);
    eyeImageView.setRotate(angle);
    eyeImageView.setScaleX(scale);
    eyeImageView.setScaleY(scale);
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:18,代码来源:SceneMainController.java

示例4: getNormalizedMapping

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
/**
 * Maps eye position of gaze coords in pixels within normalized space [x: -1:1 , y: -1:1]
 * 
 * @param point in pixels
 * @param dimWidth width of area to map relative coordinates to
 * @param dimHeight height of area to map relative coordinates to
 * @return a relative point mapped into normalized space [x: -1:1 , y: -1:1]
 */
@Nullable
public static Point2D getNormalizedMapping(Point2D point, int dimWidth, int dimHeight)
{
    Point2D normMap = getNormalizedCoords(point, dimWidth, dimHeight);

    if (null != normMap)
    {
        // scale up and shift
        normMap.x *= 2f;
        normMap.x -= 1f;
        normMap.y *= 2f;
        normMap.y -= 1f;
    }

    return normMap;
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:25,代码来源:GazeUtils.java

示例5: testGazeData

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
@Test
public void testGazeData()
{
    Gson gson = new Gson();

    Random r = new Random();

    GazeData gd = new GazeData();
    gd.leftEye.pupilSize = 11.1f;
    gd.rightEye.pupilCenterCoordinates.x = 800.13f;
    gd.state = 1;
    gd.rightEye.pupilCenterCoordinates = new Point2D(r.nextFloat(), r.nextFloat());
    gd.leftEye.rawCoordinates = new Point2D(r.nextFloat(), r.nextFloat());

    Assert.assertNotNull(gd.state);
    Assert.assertTrue(!gd.hasRawGazeCoordinates());

    String json = gson.toJson(gd);
    GazeData gd2 = gson.fromJson(json, GazeData.class);

    Assert.assertEquals(gd,gd2);
    Assert.assertEquals(gd.hashCode(),gd2.hashCode());
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:24,代码来源:TestApiClient.java

示例6: testCalibrationResult

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
@Test
public void testCalibrationResult()
{
    Gson gson = new Gson();

    CalibrationResult cr = new CalibrationResult();
    cr.averageErrorDegree = 11.1f;
    cr.averageErrorDegreeRight = 800.13f;
    CalibrationPoint cp = new CalibrationResult.CalibrationPoint();
    cp.standardDeviation.averageStandardDeviationPixelsLeft = 123.123f;
    cp.coordinates = new Point2D(321.123f, 432.234f);
    cr.calibpoints = new CalibrationPoint[]{cp};

    String json = gson.toJson(cr);
    CalibrationResult cr2 = gson.fromJson(json, CalibrationResult.class);

    Assert.assertEquals(cr,cr2);
    Assert.assertEquals(cr.hashCode(),cr2.hashCode());
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:20,代码来源:TestApiClient.java

示例7: getGazeIndicatorAnchor

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
/**
 * Calculated top left corner of Gaze Indicator based on gaze coordinates, indicator view.
 * <p>
 * The returned anchor point is offset according to the anchor of the Activity ContentView
 * to ensure that possible ActionBar offsets are taken into account.
 *
 * @param gazeCoords
 * @return
 */
public javafx.geometry.Point2D getGazeIndicatorAnchor(final Point2D gazeCoords)
{
    if(null != gazeCoords)
        return innerRoot.screenToLocal(
                gazeCoords.x - (gazeIndicator.getFitWidth() * .5d),
                gazeCoords.y - (gazeIndicator.getFitHeight() * .5d)
        );

    return null;
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:20,代码来源:SceneController.java

示例8: adjustPointForResampling

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
/**
 * Helper methods that move calibration points towards center before resampling.
 * Increases success rate.
 *
 * @param calPoint
 * @return
 */
private Point2D adjustPointForResampling(Point2D calPoint)
{
    Point2D p = new Point2D(calPoint.x, calPoint.y);
    int factor = 7;
    double adjustX = innerRoot.getWidth() / factor;
    double adjustY = innerRoot.getHeight() / factor;

    //TODO: Fix with generic approach, Vector based

    // Determine how to move the point, if point occurs on
    //   Top edge    -> Move down by areaHeight/factor
    //   Bottom edge -> Move up by areaHeight/factor
    //   Left edge   -> Move right by areaWidth/factor
    //   Right edge  -> Move left by areaWidth/factor

    if (p.x == (mCalibPadding))
        p.x += adjustX;
    else if (p.x == innerRoot.getWidth() - (mCalibPadding))
        p.x -= adjustX;

    if (p.y == (mCalibPadding))
        p.y += adjustY;
    else if (p.y == innerRoot.getHeight() - (mCalibPadding))
        p.y -= adjustY;

    return p;
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:35,代码来源:SceneCalibrationController.java

示例9: onGazeUpdate

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
@Override
public void onGazeUpdate(GazeData gazeData)
{
    Platform.runLater(() -> {

        if (!mIsRecievingFrames)
        {
            if(null != progress)
            {
                progress.setVisible(false);

                initGazeButtons();

                rating.setRating(JavaFxCalibUtils.getCalibRating(GazeManager.getInstance().getLastCalibrationResult()));

                mIsRecievingFrames = true;
            }
        }

        Point2D gaze = GazeFrameCache.getInstance().getLastSmoothedGazeCoordinates();
        if (null != gaze) {
            gazeIndicator.setVisible(true);
            javafx.geometry.Point2D rootAnchor = getGazeIndicatorAnchor(gaze);
            gazeIndicator.setX(rootAnchor.getX());
            gazeIndicator.setY(rootAnchor.getY());
        } else
            gazeIndicator.setVisible(false);
    });
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:30,代码来源:SceneEvaluationController.java

示例10: checkGazeCollision

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
public static boolean checkGazeCollision(Node n, Point2D gaze)
{
    if(null == n || null == gaze )
        return false;

    Rectangle roi = new Rectangle();

    return checkViewCollision(n, gaze, roi);
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:10,代码来源:JavaFxGazeUtils.java

示例11: checkGazeCollisionRecursive

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
public static void checkGazeCollisionRecursive(Node n, Point2D gaze, List<Node> result)
{
    if(null == n || null == gaze || null == result)
        return;

    Pane p;
    Rectangle roi = new Rectangle();
    if(n instanceof Pane)
    {
        p = ((Pane)n);

        if(!p.isDisabled() && checkViewCollision(p, gaze, roi))
            result.add(p);

        ObservableList<Node> children = p.getChildren();
        for(int i=0; i<children.size(); ++i)
        {
            Node nextChild = children.get(i);

            if(nextChild instanceof Pane)
                checkGazeCollisionRecursive(nextChild, gaze, result);
            else if(checkViewCollision(nextChild, gaze, roi))
                result.add(nextChild);
        }
    }
    else
    {
        if(checkViewCollision(n, gaze, roi))
            result.add(n);
    }
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:32,代码来源:JavaFxGazeUtils.java

示例12: checkViewCollision

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
private static boolean checkViewCollision(Node n, Point2D gaze, Rectangle roi)
{
    javafx.geometry.Point2D screenCoord = n.localToScreen(0d, 0d);

    roi.setX(Math.round(screenCoord.getX()));
    roi.setY(Math.round(screenCoord.getY()));
    roi.setWidth(n.getBoundsInParent().getWidth());
    roi.setHeight(n.getBoundsInParent().getHeight());

    return roi.contains(
            (int)Math.round(gaze.x),
            (int)Math.round(gaze.y)
    );
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:15,代码来源:JavaFxGazeUtils.java

示例13: GazeFrameCache

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
private GazeFrameCache(int timeLimit)
{
    mFrames = new GazeDataDeque(timeLimit);
    mValidFramePredicate = new ValidFrame();

    //init user distance values
    mLastEyesVecHalf = new Point2D(.2f, 0f);
    mLastEyeDistance = 1f - ((mMinEyesDistance + ((mMaxEyesDistance - mMinEyesDistance) * .5f)) / mMaxEyesDistance);
    mLastUserPosition = new Point3D(GazeManager.getInstance().getScreenResolutionWidth() >> 1, GazeManager.getInstance().getScreenResolutionHeight() >> 1, mLastEyeDistance);
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:11,代码来源:GazeFrameCache.java

示例14: initCalibrationPoints

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
public static List<Point2D> initCalibrationPoints(int rows, int columns, @Nonnull Region region, double paddingHors, double paddingVert, boolean shuffle)
{
    if(null == region)
        throw new IllegalArgumentException("Region cannot be null!");

    return initCalibrationPoints(rows, columns, region.getWidth(), region.getHeight(), paddingHors, paddingVert, shuffle);
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:8,代码来源:JavaFxCalibUtils.java

示例15: onGazeUpdate

import com.theeyetribe.clientsdk.data.Point2D; //导入依赖的package包/类
@Override
public void onGazeUpdate(GazeData gazeData) {
    Platform.runLater(() -> {
        Point2D gaze = GazeFrameCache.getInstance().getLastSmoothedGazeCoordinates();
        final long lastFrameDelta = GazeFrameCache.getInstance().getLastDelta();

        mIsGazeColliding = false;

        // check bounds
        if (null != gaze && checkCollision(gaze))
        {

            // heating up, capping if too high
            if (mCooldownValue + lastFrameDelta < mCooldownPeriod)
                mCooldownValue += lastFrameDelta;
            else
                mCooldownValue = mCooldownPeriod;

            mIsGazeColliding = true;
        }
        else
        {
            // cooling down
            if (mCooldownValue - lastFrameDelta > 0)
                mCooldownValue -= lastFrameDelta;
            else
                mCooldownValue = 0;
        }
    });
}
 
开发者ID:EyeTribe,项目名称:tet-java-client,代码行数:31,代码来源:GazePane.java


注:本文中的com.theeyetribe.clientsdk.data.Point2D类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。