us.ihmc.yoVariables.variable.YoFrameLineSegment2D类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中us.ihmc.yoVariables.variable.YoFrameLineSegment2D类的一些代码示例,展示了YoFrameLineSegment2D类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YoFrameLineSegment2D类的具体详情如下:
包路径:us.ihmc.yoVariables.variable.YoFrameLineSegment2D
类名称:YoFrameLineSegment2D

YoFrameLineSegment2D介绍

[英]FixedFrameLineSegment2DBasics implementation which endpoints baked with YoVariables.
[中]FixedFrameLineSegment2DBasics实现,端点使用变量烘焙。

代码示例

代码示例来源:origin: us.ihmc/ihmc-graphics-description

private YoArtifactLineSegment2d(String name, YoDouble startX, YoDouble startY, YoDouble endX, YoDouble endY, Color color, double arrowHeadWidth, double arrowHeadHeight)
{
 this(name, new YoFrameLineSegment2D(startX, startY, endX, endY, ReferenceFrame.getWorldFrame()), color, arrowHeadWidth, arrowHeadHeight);
}

代码示例来源:origin: us.ihmc/ihmc-graphics-description

public YoArtifactLineSegment2d(String name, YoFrameLineSegment2D lineSegment, Color color)
{
 super(name, new double[0], color,
    lineSegment.getYoFirstEndpointX(), lineSegment.getYoFirstEndpointY(), lineSegment.getYoSecondEndpointX(), lineSegment.getYoSecondEndpointY());
 this.lineSegment = lineSegment;
 this.drawArrow = false;
}

代码示例来源:origin: us.ihmc/ihmc-graphics-description

graphics.setStroke(STROKE);
if (lineSegment.getFirstEndpoint().equals(lineSegment.getSecondEndpoint()))
  tempFirstEndpoint.set(lineSegment.getFirstEndpointX(), lineSegment.getFirstEndpointY());
  graphics.drawPoint(tempFirstEndpoint);
  arrowHeadVector.set(lineSegment.getSecondEndpointX() - lineSegment.getFirstEndpointX(), lineSegment.getSecondEndpointY() - lineSegment.getFirstEndpointY());
  arrowHeadVector.normalize();
  arrowHeadLateralVector.set(arrowHeadVector.getY(), -arrowHeadVector.getX());
  arrowHeadLateralVector.scale(arrowHeadWidth / 2.0);
  ((Tuple2DBasics) tempArrowPolygon.getVertex(0)).set(lineSegment.getSecondEndpointX(), lineSegment.getSecondEndpointY());
  ((Tuple2DBasics) tempArrowPolygon.getVertex(1)).set(lineSegment.getSecondEndpointX(), lineSegment.getSecondEndpointY());
  ((Tuple2DBasics) tempArrowPolygon.getVertex(1)).sub(arrowHeadVector);
  ((Tuple2DBasics) tempArrowPolygon.getVertex(1)).sub(arrowHeadLateralVector);
  ((Tuple2DBasics) tempArrowPolygon.getVertex(2)).set(lineSegment.getSecondEndpointX(), lineSegment.getSecondEndpointY());
  ((Tuple2DBasics) tempArrowPolygon.getVertex(2)).sub(arrowHeadVector);
  ((Tuple2DBasics) tempArrowPolygon.getVertex(2)).add(arrowHeadLateralVector);

代码示例来源:origin: us.ihmc/ihmc-graphics-description

@Override
  public YoArtifact duplicate(YoVariableRegistry newRegistry)
  {
   return new YoArtifactLineSegment2d(getName(), lineSegment.duplicate(newRegistry), color, arrowHeadWidth, arrowHeadHeight);
  }
}

代码示例来源:origin: us.ihmc/ihmc-graphics-description

public YoArtifactLineSegment2d(String name, YoFrameLineSegment2D lineSegment, Color color, double arrowHeadWidth, double arrowHeadHeight)
{
 super(name, new double[0], color,
    lineSegment.getYoFirstEndpointX(), lineSegment.getYoFirstEndpointY(), lineSegment.getYoSecondEndpointX(), lineSegment.getYoSecondEndpointY());
 this.lineSegment = lineSegment;
 this.drawArrow = true;
 instatiateArrowObjects(arrowHeadWidth, arrowHeadHeight);
}

代码示例来源:origin: us.ihmc/ihmc-yovariables

/**
* Creates a copy of {@code this} by finding the duplicated {@code YoVariable}s in the given
* {@link YoVariableRegistry}.
* <p>
* This method does not duplicate {@code YoVariable}s. Assuming the given registry is a duplicate
* of the registry that was used to create {@code this}, this method searches for the duplicated
* {@code YoVariable}s and use them to duplicate {@code this}.
* </p>
*
* @param newRegistry YoVariableRegistry to duplicate {@code this} to.
* @return the duplicate of {@code this}.
*/
public YoFrameLineSegment2D duplicate(YoVariableRegistry newRegistry)
{
 return new YoFrameLineSegment2D(firstEndpoint.duplicate(newRegistry), secondEndpoint.duplicate(newRegistry));
}

代码示例来源:origin: us.ihmc/simulation-construction-set-test

radii.set(1.0, 0.7);
YoFrameLineSegment2D lineSegment = new YoFrameLineSegment2D("segmentGuy", "", ReferenceFrame.getWorldFrame(), registry);
lineSegment.getYoFirstEndpointX().set(1.0);
lineSegment.getYoFirstEndpointY().set(1.0);
lineSegment.getYoSecondEndpointX().set(2.0);
lineSegment.getYoSecondEndpointY().set(2.0);

代码示例来源:origin: us.ihmc/ihmc-graphics-description

private static YoArtifactLineSegment2d yoArtifactLineSegment2DFromMessage(String name, YoVariable<?>[] vars, double[] consts,
                                     AppearanceDefinition appearance)
{
 YoFrameLineSegment2D segment = new YoFrameLineSegment2D((YoDouble) vars[0], (YoDouble) vars[1], (YoDouble) vars[2], (YoDouble) vars[3],
                             ReferenceFrame.getWorldFrame());
 return new YoArtifactLineSegment2d(name, segment, appearance.getColor().get());
}

代码示例来源:origin: us.ihmc/ihmc-graphics-description

public YoArtifactLineSegment2d(String name, YoFramePoint2D start, YoFramePoint2D end, Color color)
{
 this(name, new YoFrameLineSegment2D(start.getYoX(), start.getYoY(), end.getYoX(), end.getYoY(), ReferenceFrame.getWorldFrame()), color);
}

代码示例来源:origin: us.ihmc/ihmc-graphics-description

@Override
public Artifact createArtifact()
{
 MutableColor color3f = appearance.getColor();
 YoDouble endPointX = new YoDouble(getName() + "ArtifactEndPointX", base.getYoX().getYoVariableRegistry());
 YoDouble endPointY = new YoDouble(getName() + "ArtifactEndPointY", base.getYoY().getYoVariableRegistry());
 base.getYoX().addVariableChangedListener(v -> endPointX.set(base.getX() + vector.getX()));
 base.getYoY().addVariableChangedListener(v -> endPointY.set(base.getY() + vector.getY()));
 vector.getYoX().addVariableChangedListener(v -> endPointX.set(base.getX() + vector.getX()));
 vector.getYoY().addVariableChangedListener(v -> endPointY.set(base.getY() + vector.getY()));
 return new YoArtifactLineSegment2d(getName(),
                   new YoFrameLineSegment2D(base.getYoX(), base.getYoY(), endPointX, endPointY, ReferenceFrame.getWorldFrame()),
                   color3f.get());
}

相关文章