• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RayCastOutput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: raycast

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
@Override
public boolean raycast(RayCastOutput output, RayCastInput input, Transform xf, int childIndex) {
  assert (childIndex < m_count);

  final EdgeShape edgeShape = pool0;

  int i1 = childIndex;
  int i2 = childIndex + 1;
  if (i2 == m_count) {
    i2 = 0;
  }
  Vec2 v = m_vertices[i1];
  edgeShape.m_vertex1.x = v.x;
  edgeShape.m_vertex1.y = v.y;
  Vec2 v1 = m_vertices[i2];
  edgeShape.m_vertex2.x = v1.x;
  edgeShape.m_vertex2.y = v1.y;

  return edgeShape.raycast(output, input, xf, 0);
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:21,代码来源:ChainShape.java


示例2: raycastCallback

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
public float raycastCallback(final RayCastInput input,
		DynamicTreeNode proxyId) {
	Actor actor = (Actor) proxyId.userData;

	RayCastOutput output = new RayCastOutput();
	boolean hit = actor.aabb.raycast(output, input, m_world.getPool());

	if (hit) {
		m_rayCastOutput = output;
		m_rayActor = actor;
		m_rayActor.fraction = output.fraction;
		return output.fraction;
	}

	return input.maxFraction;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:DynamicTreeTest.java


示例3: raycast

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
@Override
public boolean raycast(RayCastOutput output, RayCastInput input, Transform xf, int childIndex) {
  assert (childIndex < m_count);

  final EdgeShape edgeShape = pool0;

  int i1 = childIndex;
  int i2 = childIndex + 1;
  if (i2 == m_count) {
    i2 = 0;
  }
  Vector2 v = m_vertices[i1];
  edgeShape.m_vertex1.x = v.x;
  edgeShape.m_vertex1.y = v.y;
  Vector2 v1 = m_vertices[i2];
  edgeShape.m_vertex2.x = v1.x;
  edgeShape.m_vertex2.y = v1.y;

  return edgeShape.raycast(output, input, xf, 0);
}
 
开发者ID:pianoman373,项目名称:Point-Engine,代码行数:21,代码来源:ChainShape.java


示例4: raycastCallback

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
public float raycastCallback(final RayCastInput input,
		int proxyId) {
	Actor actor = (Actor) m_tree.getUserData(proxyId);

	RayCastOutput output = new RayCastOutput();
	boolean hit = actor.aabb.raycast(output, input, getWorld().getPool());

	if (hit) {
		m_rayCastOutput = output;
		m_rayActor = actor;
		m_rayActor.fraction = output.fraction;
		return output.fraction;
	}

	return input.maxFraction;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:17,代码来源:DynamicTreeTest.java


示例5: raycastCallback

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
public float raycastCallback(final RayCastInput input,
		DynamicTreeNode proxyId) {
	Actor actor = (Actor) proxyId.userData;

	RayCastOutput output = new RayCastOutput();
	boolean hit = actor.aabb.raycast(output, input, getWorld().getPool());

	if (hit) {
		m_rayCastOutput = output;
		m_rayActor = actor;
		m_rayActor.fraction = output.fraction;
		return output.fraction;
	}

	return input.maxFraction;
}
 
开发者ID:col726,项目名称:game-engine-CMZ,代码行数:17,代码来源:DynamicTreeTest.java


示例6: raycast

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
/**
 * @see Shape#raycast(org.jbox2d.collision.RayCastOutput,
 *      org.jbox2d.collision.RayCastInput, org.jbox2d.common.Transform, int)
 */
@Override
public final boolean raycast(RayCastOutput argOutput, RayCastInput argInput, Transform argTransform) {
	
	final Vec2 position = pool1;
	final Vec2 s = pool2;
	final Vec2 r = pool3;
	
	Mat22.mulToOut(argTransform.R, m_p, position);
	position.addLocal(argTransform.position);
	s.set(argInput.p1).subLocal(position);
	final float b = Vec2.dot(s, s) - m_radius * m_radius;
	
	// Solve quadratic equation.
	r.set(argInput.p2).subLocal(argInput.p1);
	final float c = Vec2.dot(s, r);
	final float rr = Vec2.dot(r, r);
	final float sigma = c * c - rr * b;
	
	// Check for negative discriminant and short segment.
	if (sigma < 0.0f || rr < Settings.EPSILON) {
		return false;
	}
	
	// Find the point of intersection of the line with the circle.
	float a = -(c + MathUtils.sqrt(sigma));
	
	// Is the intersection point on the segment?
	if (0.0f <= a && a <= argInput.maxFraction * rr) {
		a /= rr;
		argOutput.fraction = a;
		argOutput.normal.set(r).mulLocal(a);
		argOutput.normal.addLocal(s);
		argOutput.normal.normalize();
		return true;
	}
	
	return false;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:43,代码来源:CircleShape.java


示例7: initTest

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
/**
 * @see org.jbox2d.testbed.framework.TestbedTest#initTest()
 */
@Override
public void initTest() {
	worldExtent = 15.0f;
	m_proxyExtent = 0.5f;

	m_tree = new DynamicTree();

	for (int i = 0; i < e_actorCount; ++i) {
		Actor actor = m_actors[i] = new Actor();
		GetRandomAABB(actor.aabb);
		actor.proxyId = m_tree.createProxy(actor.aabb, actor);
	}

	m_stepCount = 0;

	float h = worldExtent;
	m_queryAABB = new AABB();
	m_queryAABB.lowerBound.set(-3.0f, -4.0f + h);
	m_queryAABB.upperBound.set(5.0f, 6.0f + h);

	m_rayCastInput = new RayCastInput();
	m_rayCastInput.p1.set(-5.0f, 5.0f + h);
	m_rayCastInput.p2.set(7.0f, -4.0f + h);
	// m_rayCastInput.p1.set(0.0f, 2.0f + h);
	// m_rayCastInput.p2.set(0.0f, -2.0f + h);
	m_rayCastInput.maxFraction = 1.0f;

	m_rayCastOutput = new RayCastOutput();

	m_automated = false;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:35,代码来源:DynamicTreeTest.java


示例8: RayCast

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
public void RayCast() {
	m_rayActor = null;

	RayCastInput input = m_rayCastInput;

	// Ray cast against the dynamic tree.
	m_tree.raycast(this, input);

	// Brute force ray cast.
	Actor bruteActor = null;
	RayCastOutput bruteOutput = new RayCastOutput();
	for (int i = 0; i < e_actorCount; ++i) {
		if (m_actors[i].proxyId == null) {
			continue;
		}

		RayCastOutput output = new RayCastOutput();
		boolean hit = m_actors[i].aabb.raycast(output, input,
				m_world.getPool());
		if (hit) {
			bruteActor = m_actors[i];
			bruteOutput = output;
		    //input.set(m_rayCastInput);
		}
	}

	if (bruteActor != null) {
		assert (MathUtils.abs(bruteOutput.fraction
				- m_rayCastOutput.fraction) <= Settings.EPSILON);
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:32,代码来源:DynamicTreeTest.java


示例9: initTest

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
@Override
public void initTest(boolean argDeserialized) {
	worldExtent = 15.0f;
	m_proxyExtent = 0.5f;

	m_tree = new DynamicTree();

	for (int i = 0; i < e_actorCount; ++i) {
		Actor actor = m_actors[i] = new Actor();
		GetRandomAABB(actor.aabb);
		actor.proxyId = m_tree.createProxy(actor.aabb, actor);
	}

	m_stepCount = 0;

	float h = worldExtent;
	m_queryAABB = new AABB();
	m_queryAABB.lowerBound.set(-3.0f, -4.0f + h);
	m_queryAABB.upperBound.set(5.0f, 6.0f + h);

	m_rayCastInput = new RayCastInput();
	m_rayCastInput.p1.set(-5.0f, 5.0f + h);
	m_rayCastInput.p2.set(7.0f, -4.0f + h);
	// m_rayCastInput.p1.set(0.0f, 2.0f + h);
	// m_rayCastInput.p2.set(0.0f, -2.0f + h);
	m_rayCastInput.maxFraction = 1.0f;

	m_rayCastOutput = new RayCastOutput();

	m_automated = false;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:32,代码来源:DynamicTreeTest.java


示例10: RayCast

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
public void RayCast() {
	m_rayActor = null;

	RayCastInput input = new RayCastInput();
	input.set(m_rayCastInput);

	// Ray cast against the dynamic tree.
	m_tree.raycast(this, input);

	// Brute force ray cast.
	Actor bruteActor = null;
	RayCastOutput bruteOutput = new RayCastOutput();
	for (int i = 0; i < e_actorCount; ++i) {
		if (m_actors[i].proxyId == -1) {
			continue;
		}

		RayCastOutput output = new RayCastOutput();
		boolean hit = m_actors[i].aabb.raycast(output, input,
				getWorld().getPool());
		if (hit) {
			bruteActor = m_actors[i];
			bruteOutput = output;
			input.maxFraction = output.fraction;
		}
	}

	if (bruteActor != null) {
	  if(MathUtils.abs(bruteOutput.fraction
                   - m_rayCastOutput.fraction) > Settings.EPSILON) {
	    System.out.println("wrong!");
	    assert (MathUtils.abs(bruteOutput.fraction
             - m_rayCastOutput.fraction) <= 20 * Settings.EPSILON);
	  }
		
	}
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:38,代码来源:DynamicTreeTest.java


示例11: initTest

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
/**
 * @see org.jbox2d.testbed.framework.TestbedTest#initTest(boolean)
 */
@Override
public void initTest(boolean argDeserialized) {
	worldExtent = 15.0f;
	m_proxyExtent = 0.5f;

	m_tree = new DynamicTree();

	for (int i = 0; i < e_actorCount; ++i) {
		Actor actor = m_actors[i] = new Actor();
		GetRandomAABB(actor.aabb);
		actor.proxyId = m_tree.createProxy(actor.aabb, actor);
	}

	m_stepCount = 0;

	float h = worldExtent;
	m_queryAABB = new AABB();
	m_queryAABB.lowerBound.set(-3.0f, -4.0f + h);
	m_queryAABB.upperBound.set(5.0f, 6.0f + h);

	m_rayCastInput = new RayCastInput();
	m_rayCastInput.p1.set(-5.0f, 5.0f + h);
	m_rayCastInput.p2.set(7.0f, -4.0f + h);
	// m_rayCastInput.p1.set(0.0f, 2.0f + h);
	// m_rayCastInput.p2.set(0.0f, -2.0f + h);
	m_rayCastInput.maxFraction = 1.0f;

	m_rayCastOutput = new RayCastOutput();

	m_automated = false;
}
 
开发者ID:col726,项目名称:game-engine-CMZ,代码行数:35,代码来源:DynamicTreeTest.java


示例12: RayCast

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
public void RayCast() {
	m_rayActor = null;

	RayCastInput input = new RayCastInput();
	input.set(m_rayCastInput);

	// Ray cast against the dynamic tree.
	m_tree.raycast(this, input);

	// Brute force ray cast.
	Actor bruteActor = null;
	RayCastOutput bruteOutput = new RayCastOutput();
	for (int i = 0; i < e_actorCount; ++i) {
		if (m_actors[i].proxyId == null) {
			continue;
		}

		RayCastOutput output = new RayCastOutput();
		boolean hit = m_actors[i].aabb.raycast(output, input,
				getWorld().getPool());
		if (hit) {
			bruteActor = m_actors[i];
			bruteOutput = output;
			input.maxFraction = output.fraction;
		    //input.set(m_rayCastInput);
		}
	}

	if (bruteActor != null) {
		assert (MathUtils.abs(bruteOutput.fraction
				- m_rayCastOutput.fraction) <= Settings.EPSILON);
	}
}
 
开发者ID:col726,项目名称:game-engine-CMZ,代码行数:34,代码来源:DynamicTreeTest.java


示例13: raycast

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
@Override
public boolean raycast(RayCastOutput output, RayCastInput input, Transform transform, int childIndex) {
    return false;
}
 
开发者ID:cburschka,项目名称:PhysLayout,代码行数:5,代码来源:ShapelessShape.java


示例14: raycast

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
/**
 * Cast a ray against a child shape.
 * 
 * @param argOutput the ray-cast results.
 * @param argInput the ray-cast input parameters.
 * @param argTransform the transform to be applied to the shape.
 * @param argChildIndex the child shape index
 * @return if hit
 */
public abstract boolean raycast(RayCastOutput output, RayCastInput input, Transform transform,
    int childIndex);
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:12,代码来源:Shape.java


示例15: raycast

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
/**
 * Cast a ray against this shape.
 * 
 * @param output the ray-cast results.
 * @param input the ray-cast input parameters.
 * @param output
 * @param input
 */
public boolean raycast(RayCastOutput output, RayCastInput input, int childIndex) {
  return m_shape.raycast(output, input, m_body.m_xf, childIndex);
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:12,代码来源:Fixture.java


示例16: raycast

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
/**
 * Cast a ray against a child shape.
 * @param argOutput the ray-cast results.
 * @param argInput the ray-cast input parameters.
 * @param argTransform the transform to be applied to the shape.
 * @param argChildIndex the child shape index
 * @return if hit
 */
public abstract boolean raycast( RayCastOutput argOutput, RayCastInput argInput, Transform argTransform);
 
开发者ID:mleoking,项目名称:PhET,代码行数:10,代码来源:Shape.java


示例17: raycast

import org.jbox2d.collision.RayCastOutput; //导入依赖的package包/类
/**
 * Cast a ray against this shape.
 * @param output the ray-cast results.
 * @param input the ray-cast input parameters.
 * @param output
 * @param input
 */
public boolean raycast(RayCastOutput output, RayCastInput input){
	return m_shape.raycast( output, input, m_body.m_xf);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:11,代码来源:Fixture.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConditionEvaluationResult类代码示例发布时间:2022-05-22
下一篇:
Java CallbackInfoReturnable类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap