我有一个带有球体的主场景和另一个子窗口(在右下角),我绘制了主场景的(x,y,z)轴.
在这个子窗口中,我想在每个轴上绘制标签"X""Y"和"Z"(更精确地位于每个AxisHelper的末尾).我知道如何使用TextGeometry,但问题是我无法旋转这些标签,以使它们始终在用户面前显示.
您可以在[以下链接] [1]上看到问题:标签"X"相对于轴固定并且正在与相机一起旋转,因此它并不总是面向用户.
从这两个链接link1和link2,我试图添加(在我的例子中,我尝试只使用"X"标签):
function addLabelAxes() {
// Axes label
var loader = new THREE.FontLoader();
loader.load( 'js/helvetiker_regular.typeface.js', function ( font ) {
var textGeo1 = new THREE.TextGeometry( 'X', {
font: font,
size: 5,
height: 0.1,
bevelThickness: 0.1,
bevelSize: 0.1,
bevelEnabled: true,
} );
var color = new THREE.Color();
color.setRGB(255, 255, 255);
textMaterial = new THREE.MeshBasicMaterial({ color: color });
var meshText1 = new THREE.Mesh(textGeo1, textMaterial);
// Position of axes extremities
var positionEndAxes = axes2.geometry.attributes.position;
var label1X …Run Code Online (Sandbox Code Playgroud) 我编写了一个小程序来测量循环所花费的时间(通过内联Sparc汇编代码片段).
一切都是正确的,直到我将迭代次数设置在大约4.0 + 9(高于2 ^ 32)之上.
这是代码片段:
#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
#include <math.h>
#include <stdint.h>
int main (int argc, char *argv[])
{
// For indices
int i;
// Set the number of executions
int nRunning = atoi(argv[1]);
// Set the sums
double avgSum = 0.0;
double stdSum = 0.0;
// Average of execution time
double averageRuntime = 0.0;
// Standard deviation of execution time
double deviationRuntime = 0.0;
// Init sum
unsigned long long int sum = 0; …Run Code Online (Sandbox Code Playgroud) 我在下图中有第一个版本的图例:
使用以下代码:
# Plot and save : kmax = 0.3
p11, = plt.plot([0], marker='None',
linestyle='None', label='$k_{max} = 0.3$')
p1, = plt.plot(FoM_vs_Density_array_1[:,0],FoM_vs_Density_array_1[:,1], '-b', label = '$GC_{sp}$')
p2, = plt.plot(FoM_vs_Density_array_1[:,0],FoM_vs_Density_array_1[:,2], '-r', label = '$GC_{ph}$')
p3, = plt.plot(FoM_vs_Density_array_1[:,0],FoM_vs_Density_array_1[:,3], '-y', label = '$WL$')
p4, = plt.plot(FoM_vs_Density_array_1[:,0],FoM_vs_Density_array_1[:,4], '-g', label = '$GC_{ph} + WL + XC$')
p5, = plt.plot(FoM_vs_Density_array_1[:,0],FoM_vs_Density_array_1[:,5], '-m', label = \
'$GC_{sp} + (GC_{ph} + WL + XC)$')
# Plot and save : kmax = 1.0
p12, = plt.plot([0], marker='None',
linestyle='None', label='$k_{max} = 1.0$') …Run Code Online (Sandbox Code Playgroud) 我正在寻找或构建两个矩阵之间的公共特征向量矩阵 X A,B例如:
AX=aX with "a" the diagonal matrix corresponding to the eigenvalues
BX=bX with "b" the diagonal matrix corresponding to the eigenvalues
Run Code Online (Sandbox Code Playgroud)
其中A和B是方阵和可对角化矩阵。
我查看了类似的帖子,但没有得出结论,即当我构建F由以下定义的最终想要的内同态时得到有效结果:F = P D P^-1
我还阅读了维基百科主题和这篇有趣的论文,但不必提取非常容易实现的方法。
特别是,我对eig(A,B)Matlab 函数很感兴趣。
我试着像这样使用它:
% Search for common build eigen vectors between FISH_sp and FISH_xc
[V,D] = eig(FISH_sp,FISH_xc);
% Diagonalize the matrix (A B^-1) to compute Lambda since we have AX=Lambda B X …Run Code Online (Sandbox Code Playgroud) 我正在学习SPARC程序集,您可以在下面看到一个简单的示例.我有几个关于这个例子的问题,它显示了一个过程的传递参数.
在主要部分中,我设置5为第一个输入参数%o0和7第二个输入参数%o1.之后,我将这些寄存器的总和放入其中%o2.然后,我调用"测试"功能,我打印这个总和.
fmt0:
.asciz "%d\n"
.align 4
.global main
main:
save %sp, -64, %sp
mov 5, %o0
mov 7, %o1
add %o0, %o1, %o2
!st %o2, [%fp-4] for storing %o2 at adress %fp-4
call test
nop
ret
test:
mov %i2, %o1
!ld [%fp-4], %o1 for loading from %fp-4 into %o1
set fmt0, %o0
call printf
nop
ret
Run Code Online (Sandbox Code Playgroud)
使用上面的代码,它打印值"-273929364"而不是"12"(用gcc编译).
似乎" mov %i2, %o1"不起作用.我知道,%o2在主要部分寄存器成为%i2在调用的过程,但我为什么不能直接设置的值%i2到%o1 …
旋转渲染球体时出现了一个奇怪的问题:动画似乎动摇了,我不知道这个问题来自哪里.
这是此链接上的示例
和渲染功能:
function render() {
controls.update();
requestAnimationFrame(render);
// For camera rotation : parametric parameter
timer = Date.now()*0.0001;
// Coordinates of camera
coordCamera.set(radiusCamera*Math.cos(timer), radiusCamera*Math.sin(timer), 0);
// Rotate camera function
rotateCamera();
// Rendering
renderer.render(scene, camera);
}
Run Code Online (Sandbox Code Playgroud)
用rotateCamera和computeRotation功能:
function computeRotation (objectRotation, coordObject) {
// Apply rotation matrix
var rotationAll = new THREE.Matrix4();
var rotationX = new THREE.Matrix4().makeRotationX(objectRotation.rotation.x);
var rotationY = new THREE.Matrix4().makeRotationY(objectRotation.rotation.y);
var rotationZ = new THREE.Matrix4().makeRotationZ(objectRotation.rotation.z);
rotationAll.multiplyMatrices(rotationX, rotationY);
rotationAll.multiply(rotationZ);
// Compute world coordinates
coordObject.applyMatrix4(rotationAll);
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试实现一个OpenCL版本来减少一个float数组.
为实现这一目标,我在网上找到了以下代码段:
__kernel void sumGPU ( __global const double *input,
__global double *partialSums,
__local double *localSums)
{
uint local_id = get_local_id(0);
uint group_size = get_local_size(0);
// Copy from global memory to local memory
localSums[local_id] = input[get_global_id(0)];
// Loop for computing localSums
for (uint stride = group_size/2; stride>0; stride /=2)
{
// Waiting for each 2x2 addition into given workgroup
barrier(CLK_LOCAL_MEM_FENCE);
// Divide WorkGroup into 2 parts and add elements 2 by 2
// between local_id and local_id + stride
if …Run Code Online (Sandbox Code Playgroud) 关于以下小代码,这在另一篇文章中有关结构大小和正确对齐数据的所有可能性的说明:
struct
{
char Data1;
short Data2;
int Data3;
char Data4;
} x;
unsigned fun ( void )
{
x.Data1=1;
x.Data2=2;
x.Data3=3;
x.Data4=4;
return(sizeof(x));
}
Run Code Online (Sandbox Code Playgroud)
我得到相应的反汇编(64位)
0000000000000000 <fun>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: c6 05 00 00 00 00 01 movb $0x1,0x0(%rip) # b <fun+0xb>
b: 66 c7 05 00 00 00 00 movw $0x2,0x0(%rip) # 14 <fun+0x14>
12: 02 00
14: c7 05 00 00 00 00 03 movl $0x3,0x0(%rip) # 1e <fun+0x1e> …Run Code Online (Sandbox Code Playgroud) 我尝试使用"纯"CSS解决方案或使用Javascript实现为方程式上的Matjax锚链接添加偏移量.
当我向下滚动页面时,我会看到一个固定的顶级菜单.我用这样的Javascript处理这种行为:
$(window).bind("load", function () {
$('a[href*="#"]').click(function(event) {
event.preventDefault();
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
var hash = this.hash;
$('html,body').animate({ scrollTop: target.offset().top - 55 }, 300, function() {
href = window.location.href;
history.pushState({page:href}, null, href.split('#')[0]+hash);
});
return false;
}
}
});
$(window).bind('popstate', function(event) {
var state = event.originalEvent.state;
var target = window.location.href.split('#');
var href = target[0];
if (state) {
$('html,body').animate({ scrollTop: …Run Code Online (Sandbox Code Playgroud) 我为网站(此处称为 website.com)生成的证书有问题。
我可以输入浏览器http://www.website.com并成功重定向到https://website.com我想要的(使用由 生成的证书let's encrypt)。我已经用 Apache2 的重写规则完成了这个重定向。重定向到https://website.com也工作正常,当我输入http://website.com。
现在,当我直接在浏览器中输入时,我遇到了一个问题https://wwww.website.com:我收到以下错误:
为了生成让我们加密证书,我执行了以下命令:
./certbot-auto certonly --no-bootstrap --no-self-upgrade --renew-by-default -a standalone -d website.com --rsa-key-size 4096
我想生成一个适用于website.com和的证书www.website.com:上面的命令cerbot-auto是否正确?
似乎在我从 Debian 7 迁移到 Debian 10 之前,我*.website.com在浏览器的证书信息窗口中有一个名字,但我不确定。
如何键入https://www.website.com并正确重定向到https://website.com而不会出现上图所示的错误?
单个证书是否足以执行所有重定向,我的意思是在我的情况下只有一个证书website.com?我以前的操作系统就是这种情况,我认为我只有一个 uniq 证书(用于website.com)。
我想要以下重定向:
http://website.com -----> https://website.com
http://www.website.com -----> https://website.com
https://www.website.com -----> https://website.com
Run Code Online (Sandbox Code Playgroud)
除了包含podcast我想保持 HTTP 模式的目录的 URL 。
所以,从 …
apache certificate url-rewriting ssl-certificate lets-encrypt
assembly ×3
c ×3
javascript ×3
mov ×2
python ×2
sparc ×2
three.js ×2
apache ×1
arrays ×1
certificate ×1
css ×1
eigenvector ×1
intel ×1
label ×1
legend ×1
lets-encrypt ×1
long-integer ×1
markers ×1
mathjax ×1
matlab ×1
matplotlib ×1
matrix ×1
opencl ×1
reduction ×1
rotation ×1
rt ×1
x86-64 ×1