小编lux*_*cem的帖子

使用旋转/缩放/翻译在Google地图上定位图像

我正在开发用于在谷歌地图上定位图像的用户界面.我从:http://overlay-tiler.googlecode.com/svn/trunk/upload.html开始,这非常接近我想要的.

但是我想要一个旋转工具,一个缩放工具和一个翻译工具(后者存在),而不是3个接触点.

我试图添加一个旋转工具,但它不能像我预期的那样工作:

我在左下角放了一个点来控制旋转(围绕图像的中心).鼠标拖动控制点,我计算其他3个点.

我的代码基于移动器对象,但我更改了onMouseMove函数:

overlaytiler.Rotater.prototype.rotateDot_ = function(dot, theta, origin) {
  dot.x = ((dot.x - origin.x) * Math.cos(theta) - (dot.y - origin.y) * Math.sin(theta)) + origin.x;
  dot.y = ((dot.x - origin.x) * Math.sin(theta) + (dot.y - origin.y) * Math.cos(theta)) + origin.y;
  dot.render();
};

overlaytiler.Rotater.prototype.onMouseMove_ = function(e) {
  var dots = this.controlDots_;
  var center = overlaytiler.Rotater.prototype.getCenter_(dots);

  // Diagonal length
  var r = Math.sqrt(Math.pow(this.x - center.x, 2) + Math.pow(this.y - center.y, 2));
  var old = {
    x: this.x, …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps image-manipulation image-rotation

6
推荐指数
1
解决办法
1857
查看次数

Laravel链接到未定义的路由

我正在对profile控制器进行分组,我想链接到那个.然后我定义了这条路线:

//Group to put all the routes that need login first
Route::group(array('prefix'=> 'admin', 'before' => 'csrf'), function(){
    Route::resource('/profile' , 'ProfileController', array('as'=>'profile') );
});
Run Code Online (Sandbox Code Playgroud)

这是我的菜单链接:

<li><a href="{{ URL::route('admin.profile') }}">profile Managment</a></li>
Run Code Online (Sandbox Code Playgroud)

这是我route在终端的结果:

+--------+----------------------------------+------------------------+---------------------------+----------------+---------------+
| Domain | URI                              | Name                   | Action                    | Before Filters | After Filters |
+--------+----------------------------------+------------------------+---------------------------+----------------+---------------+
|        | GET /                            | index                  | Closure                   |                |               |
|        | GET admin/index                  | dashboard              | Closure                   |                |               |
|        | GET logout                       | logout                 | …
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-4

4
推荐指数
1
解决办法
2万
查看次数

如何从等角投影中绘制正交投影

我有这个图像: https://raw.githubusercontent.com/Mihara/RasterPropMonitor/master/GameData/JSI/RasterPropMonitor/Library/Components/NavBall/NavBall000.png

我不知道究竟是什么样的投影,我猜是形状的equirectangular或mercator.这是态度指标的纹理,b.

我想根据由两个角度(航向和俯仰)定义的方向向量绘制正投影,b或者可能是一个普通透视投影(哪个看起来更好).此方向定义球体上的一个点,此点应该是投影的中心.

我希望它从飞行员的角度来看,因此只应绘制一半的球体.

我使用python,我还没有选择图形库,但我可能会使用pygame.

我找到了相关的东西:http://www.pygame.org/project-Off-Center+Map+Projections-2881-.html但是它使用的是OpenGL而我没有使用它的经验,但我可以尝试,如果需要的话.

我该怎么办?我可能可以通过计算计算公式中的每个像素来手动绘制它,但我认为有一些库工具可以有效地做到这一点(硬件加速可能?).

python opengl pygame map-projections

4
推荐指数
1
解决办法
2165
查看次数

具有 TypeORM Active Record 实现的 Nest.js 项目

我正在尝试使用 Nest.js 和 TypeORM 构建一个项目。我喜欢TypeORM 中的Active Record 方法

我定义一个实体如下,带有一些静态辅助方法:

export class Book extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @Column()
  description: string;

  static async createNew(attributes: BookDto): Promise<Book> {
    const entity = new Book();
    entity.name = attributes.name;
    entity.description = attributes.description;

    return entity.save();
  }

  static async findByName(name: string): Promise<Book> {
    return Book.findOne({
      where: { name },
    });
  }
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试遵循 Nest 文档中的模式将其注入我的服务中:

@Injectable()
export class BookService {
  constructor(
    @InjectRepository(Book)
    private readonly bookRepository: Repository<Book>,
  ) {}

  async create(bookAttrs: BookDto): Promise<Book> …
Run Code Online (Sandbox Code Playgroud)

typeorm nestjs

3
推荐指数
1
解决办法
3886
查看次数

光线追踪 / Phong

我不知道像 Phong 或 Gouraud 这样的光线追踪和着色技术之间的区别。

对于 3D 建模,必须在这些算法之间进行选择,或者它们可以在同一算法中实现。

谢谢你。

raytracing

2
推荐指数
1
解决办法
6717
查看次数

Cakephp:多模型评论系统

我正在使用cakephp,我有一个带有两个字段的模型"comment":"model_type"和"model_id",以便使用单个Comment模型评论我的应用程序的每个项目(例如图片,新闻,文章......) .

我想知道如何做到这一点.(可以评论的控制器的组件"注释"?)

最后,我想在一个帮助器中列出注释:$ comment-> show('model_name','item_id'); 这将显示正确的分页注释和用于向项添加新注释的表单.

谢谢.

php pagination cakephp

2
推荐指数
1
解决办法
1113
查看次数

刷新众多蓝牙外设的RSSI值

我正在尝试从几个蓝牙外设测量 iOS(6 带 BLE)上的 RSSI 指示器。我可以通过 scanForPeripheral 获得 RSSI:

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], CBCentralManagerScanOptionAllowDuplicatesKey, nil];

[_manager scanForPeripheralsWithServices:nil
                                 options:options];
Run Code Online (Sandbox Code Playgroud)

加上:

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI {
Run Code Online (Sandbox Code Playgroud)

这有效,但我无法控制接收数据包的速率,结果似乎不确定。

我读过:https : //stackoverflow.com/a/12486927/270209但我的速度根本不接近 100ms(更多 1~2 秒)

如果我连接到设备,readRSSI 的结果似乎更可靠。

我正在寻找一种方法来“刺激”外围设备以在扫描模式下进行更频繁的更新,或者一次连接到多个外围设备的方法。

谢谢

编辑:我也尝试过快速启动/停止扫描,似乎在开始扫描时检测到更多设备并且更新更频繁

bluetooth objective-c ios core-bluetooth bluetooth-lowenergy

1
推荐指数
1
解决办法
6806
查看次数

找到最小化树深度的根

给内容没有循环的树(例如最小生成树:http://fr.wikipedia.org/wiki/Fichier : Minimum_spanning_tree.svg)如果将树用作root用户,如何计算哪个节点最小化?

algorithm tree graph

0
推荐指数
2
解决办法
3791
查看次数