本文整理汇总了Java中jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult类的典型用法代码示例。如果您正苦于以下问题:Java NyARTransMatResult类的具体用法?Java NyARTransMatResult怎么用?Java NyARTransMatResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NyARTransMatResult类属于jp.nyatla.nyartoolkit.core.transmat包,在下文中一共展示了NyARTransMatResult类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: display
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
public void display(GLAutoDrawable drawable)
{
NyARTransMatResult transmat_result=__display_transmat_result;
try {
if (!_cap_image.hasData()) {
return;
}
_gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Clear the buffers for new frame.
//画像チェックしてマーカー探して、背景を書く
boolean is_marker_exist;
synchronized (_cap_image) {
is_marker_exist = _nya.detectMarkerLite(_cap_image, 110);
//背景を書く
_glnya.drawBackGround(_cap_image, 1.0);
}
//マーカーがあれば、立方体を描画
if (is_marker_exist) {
//マーカーの一致度を調査するならば、ここでnya.getConfidence()で一致度を調べて下さい。
// Projection transformation.
_gl.glMatrixMode(GL.GL_PROJECTION);
_gl.glLoadMatrixd(_camera_projection, 0);
_gl.glMatrixMode(GL.GL_MODELVIEW);
// Viewing transformation.
_gl.glLoadIdentity();
//変換行列を取得
_nya.getTransmationMatrix(transmat_result);
//変換行列をOpenGL形式に変換
_glnya.toCameraViewRH(transmat_result, __display_wk);
_gl.glLoadMatrixd(__display_wk, 0);
// All other lighting and geometry goes here.
drawCube();
}
Thread.sleep(1);//タスク実行権限を一旦渡す
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: display
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
public void display(GLAutoDrawable drawable)
{
NyARTransMatResult transmat_result=__display_transmat_result;
try {
if (!_cap_image.hasBuffer()) {
return;
}
_gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Clear the buffers for new frame.
//画像チェックしてマーカー探して、背景を書く
boolean is_marker_exist;
synchronized (_cap_image) {
is_marker_exist = _nya.detectMarkerLite(_cap_image, 110);
//背景を書く
_glnya.drawBackGround(_cap_image, 1.0);
}
//マーカーがあれば、立方体を描画
if (is_marker_exist) {
//マーカーの一致度を調査するならば、ここでnya.getConfidence()で一致度を調べて下さい。
// Projection transformation.
_gl.glMatrixMode(GL.GL_PROJECTION);
_gl.glLoadMatrixd(_camera_projection, 0);
_gl.glMatrixMode(GL.GL_MODELVIEW);
// Viewing transformation.
_gl.glLoadIdentity();
//変換行列を取得
_nya.getTransmationMatrix(transmat_result);
//変換行列をOpenGL形式に変換
_glnya.toCameraViewRH(transmat_result, __display_wk);
_gl.glLoadMatrixd(__display_wk, 0);
// All other lighting and geometry goes here.
drawCube();
}
Thread.sleep(1);//タスク実行権限を一旦渡す
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: initRotByPrevResult
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
public final void initRotByPrevResult(NyARTransMatResult i_prev_result)
{
this.m00 =(long)(i_prev_result.m00*0x1000000);
this.m01 =(long)(i_prev_result.m01*0x1000000);
this.m02 =(long)(i_prev_result.m02*0x1000000);
this.m10 =(long)(i_prev_result.m10*0x1000000);
this.m11 =(long)(i_prev_result.m11*0x1000000);
this.m12 =(long)(i_prev_result.m12*0x1000000);
this.m20 =(long)(i_prev_result.m20*0x1000000);
this.m21 =(long)(i_prev_result.m21*0x1000000);
this.m22 =(long)(i_prev_result.m22*0x1000000);
return;
}
示例4: markerChanged
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
public void markerChanged(MarkerChangedEvent event) {
Node model = getNodeForMarker(event.getMarker());
if(model == null) return;
NyARTransMatResult transMatResult = event.getTransMatResult();
if (matrixSmoothing){
MatrixSmoother matSmooth = event.getMarker().getMatrixSmoother();
matSmooth.add(transMatResult);
Matrix4f averageMatrix = matSmooth.getAverageMatrix();
model.setLocalRotation(new Matrix3f((float) averageMatrix.m00, (float) averageMatrix.m01,(float) averageMatrix.m02,
(float) averageMatrix.m10, (float) averageMatrix.m11, (float) averageMatrix.m12, (float) averageMatrix.m20,
(float) averageMatrix.m21, (float) averageMatrix.m22));
//TODO sort out the translation problem here using average matrix
model.setLocalTranslation((float) averageMatrix.m03/10, (float) averageMatrix.m13/10, (float) averageMatrix.m23/10);
System.out.println("TRANS: [" + -transMatResult.m03 + ", " + -transMatResult.m13 + ", " + -transMatResult.m23 + "], AVG: [" +
averageMatrix.get(0,3)/10 + ", " + averageMatrix.get(1,3)/10 + ", " + averageMatrix.get(2,3)/10 + "]");
}else{
model.setLocalRotation(new Matrix3f((float) -transMatResult.m00,
(float) -transMatResult.m01, (float) transMatResult.m02,
(float) -transMatResult.m10, (float) -transMatResult.m11,
(float) transMatResult.m12, (float) -transMatResult.m20,
(float) -transMatResult.m21, (float) transMatResult.m22));
model.setLocalTranslation((float) -transMatResult.m03,
(float) -transMatResult.m13, (float) -transMatResult.m23);
}
}
示例5: setTransMatResult
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
public void setTransMatResult(NyARTransMatResult transMatResult){
this.transMatResult = transMatResult;
}
示例6: getTransMatResult
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
@Override
public NyARTransMatResult getTransMatResult() {
return transMatResult;
}
示例7: markerChanged
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
@Override
public void markerChanged(MarkerChangedEvent event) {
Marker marker = event.getMarker();
boolean track = false;
Marker source = null;
Marker target = null;
for (MarkerDistanceRelationship rel : distanceRelationships) {
/*
* Allows the system to track relationships regardless of which way
* around they are declared, so can switch source to target and
* target to source. This helps with occlusion tracking.
*/
if (rel.getSource().equals(marker)) {
source = marker;
target = rel.getTarget();
track = true;
// } else if (rel.getTarget().equals(marker)) {
// source = rel.getSource();
// target = marker;
// track = true;
} else {
track = false;
}
Node n = rel.getNode();
if (track == true) {
NyARTransMatResult transMatResult = source.getTransMatResult();
NyARTransMatResult targetTransMat = new NyARTransMatResult();
targetTransMat = target.getTransMatResult();
try {
//n.detachAllChildren();
// store the positions of the markers as vectors for use in
// calculations.
Vector3f sourcePos = new Vector3f(
(float) -transMatResult.m03,
(float) -transMatResult.m13,
(float) -transMatResult.m23);
Vector3f targetPos = new Vector3f(
(float) -targetTransMat.m03,
(float) -targetTransMat.m13,
(float) -targetTransMat.m23);
// In order to draw a line we have to provide an array of
// Vector3f objects
Vector3f[] v = new Vector3f[2];
v[0] = sourcePos;
v[1] = targetPos;
/**
* attempt line drawing
*/
Line line = new Line(source.getUniqueID() + ">"
+ target.getUniqueID(), v, null, null, null);
line.setSolidColor(ColorRGBA.green);
line.setLineWidth(10f);
n.attachChild(line);
} catch (NullPointerException e) {
// In the case that one of the markers in the relationship
// cannot be found, all lines are removed from the node.
n.detachAllChildren();
}
}else {
n.detachAllChildren();
}
}
}
示例8: add
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
public void add(NyARTransMatResult transMatResult) {
Matrix4f matrix = new Matrix4f((float) -transMatResult.m00,
(float) -transMatResult.m01, (float) -transMatResult.m02,
(float) -transMatResult.m03, (float) -transMatResult.m10,
(float) -transMatResult.m11, (float) -transMatResult.m12,
(float) -transMatResult.m13, (float) transMatResult.m20,
(float) transMatResult.m21, (float) transMatResult.m22,
(float) -transMatResult.m23, 0, 0, 0, 1);
if((matrixHistory.size() == historySize)&& matrixHistory.size() > 0){
matrixHistory.remove(0);
}
matrixHistory.add(matrix);
}
示例9: onUpdateHandler
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
@Override
protected void onUpdateHandler(NyARSquare square, NyARTransMatResult result) {
this.transMatResult = result;
}
示例10: getTransMatResult
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
public NyARTransMatResult getTransMatResult(){
return this.transMatResult;
}
示例11: MarkerChangedEvent
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
public MarkerChangedEvent(Marker m, NyARTransMatResult transMatResult) {
this.marker = m;
this.transMatResult = transMatResult;
this.marker.setTransMatResult(transMatResult);
}
示例12: getTransMatResult
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
public NyARTransMatResult getTransMatResult() {
return transMatResult;
}
示例13: setTransMatResult
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
public void setTransMatResult(NyARTransMatResult transMatResult);
示例14: getTransMatResult
import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult; //导入依赖的package包/类
public NyARTransMatResult getTransMatResult();