曲面细分的理论和算法

2024-03-02

我有以下问题:

以下是我在屏幕上绘制立方体的方法:

void drawCube()
{

    //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers
    glPushAttrib(GL_POLYGON_BIT | GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT) ;

    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) ;
    //glDisable(GL_LIGHTING) ;

    glBegin(GL_QUADS);                // Begin drawing the color cube with size 3cm x 3.5cm x 4cm
        // Top face (y = 1.0f)
        // Define vertices in counter-clockwise (CCW) order with normal pointing out
        glColor3f(0.0f, 1.0f, 0.0f);     // Green
        glVertex3f( 1.75f, 1.75f, -4.0f);
        glVertex3f(-1.75f, 1.75f, -4.0f);
        glVertex3f(-1.75f, 1.75f,  1.0f);
        glVertex3f( 1.75f, 1.75f,  1.0f);

        // Bottom face (y = -1.0f)
        glColor3f(1.0f, 0.5f, 0.0f);     // Orange
        glVertex3f( 1.75f, -1.75f,  1.0f);
        glVertex3f(-1.75f, -1.75f,  1.0f);
        glVertex3f(-1.75f, -1.75f, -4.0f);
        glVertex3f( 1.75f, -1.75f, -4.0f);

        // Front face  (z = 1.0f)
        glColor3f(1.0f, 0.0f, 0.0f);     // Red
        glVertex3f( 1.75f,  1.75f, 1.0f);
        glVertex3f(-1.75f,  1.75f, 1.0f);
        glVertex3f(-1.75f, -1.75f, 1.0f);
        glVertex3f( 1.75f, -1.75f, 1.0f);

        // Back face (z = -1.0f)
        glColor3f(1.0f, 1.0f, 0.0f);     // Yellow
        glVertex3f( 1.75f, -1.75f, -4.0f);
        glVertex3f(-1.75f, -1.75f, -4.0f);
        glVertex3f(-1.75f,  1.75f, -4.0f);
        glVertex3f( 1.75f,  1.75f, -4.0f);

        // Left face (x = -1.0f)
        glColor3f(0.0f, 0.0f, 1.0f);     // Blue
        glVertex3f(-1.75f,  1.75f,  1.0f);
        glVertex3f(-1.75f,  1.75f, -4.0f);
        glVertex3f(-1.75f, -1.75f, -4.0f);
        glVertex3f(-1.75f, -1.75f,  1.0f);

        // Right face (x = 1.0f)
        glColor3f(1.0f, 0.0f, 1.0f);     // Magenta
        glVertex3f(1.75f,  1.75f, -4.0f);
        glVertex3f(1.75f,  1.75f,  1.0f);
        glVertex3f(1.75f, -1.75f,  1.0f);
        glVertex3f(1.75f, -1.75f, -4.0f);
    glEnd();  // End of drawing color-cube


    glPopAttrib() ;
}

问题是如何在所有顶点之间分配“样本点”?

根据我的理解,我需要找到顶点之间的距离并将其分成(比如说)五个相等的部分。为了方便讨论,假设两个顶点之间的间距为 1,因此 5 个点将放置在彼此相距 0.2 的距离处。此外,它们需要以内存结构(向量/数组)的形式存储,以便稍后可以访问它们中的每一个并将其转换为屏幕坐标。

然而,我怎样才能在 C++ 中以一种完全通用的方式做到这一点,以便它基本上可以应用于任何距离度量?

这是立方体的样子 https://i.stack.imgur.com/0N4af.png


这是我的drawBox函数,如果你愿意,你可以修改它以在每个面上绘制不同的颜色。

void DrawBox(GLfloat fWidth,GLfloat fHeight,GLfloat fDepth,GLint wslices,GLint dslices,GLint stacks)
{
     // Calculate number of primitives on each side of box
     // because we can use different tessalation configurations 
     // we must calculate separate group of box sides 

    int iTopButtonQuads = wslices * dslices * 2; // Calculate number of quads in top and button sides
    int iLeftRightQuads = dslices * stacks * 2; // Calculate number of quads in left and right sides
    int iFrontBackQuads = wslices * stacks * 2; // Calculate number of quads in front and back sides

    // If we consider to use quads as primitive then each primitive will
    // have 4 points, and each point has color, coord and normal attribute.
    // So we create separate array to contain each attibute values.

    float* pfVertices = new float[(iTopButtonQuads + iLeftRightQuads + iFrontBackQuads) * 3 * 4];
    float* pfColors = new float[(iTopButtonQuads + iLeftRightQuads + iFrontBackQuads) * 3 * 4];
    float* pfNormals = new float[(iTopButtonQuads + iLeftRightQuads + iFrontBackQuads) * 3 * 4];

    int iVertexIndex = 0;

    GLfloat Xstep = fWidth / wslices;
    GLfloat Ystep = fHeight / stacks;
    GLfloat Zstep = fDepth / dslices;

    GLfloat firstX = fWidth / 2.0f;
    GLfloat firstY = fHeight / 2.0f;
    GLfloat firstZ = fDepth / 2.0f;

    GLfloat currX = 0.0f;
    GLfloat currY = 0.0f;
    GLfloat currZ = 0.0f;

    GLfloat x_status = 0.0f;
    GLfloat y_status = 0.0f;
    GLfloat z_status = 0.0f;

    // the bottom and the top of the box
    for (currZ = -firstZ, z_status = 0.0f; currZ < firstZ - Zstep / 2.0f; currZ += Zstep, z_status += Zstep)
    {
        for (currX = -firstX, x_status = 0.0f; currX < firstX - Xstep / 2.0f; currX += Xstep, x_status += Xstep)
        {
            int iCurrentIndex = iVertexIndex * 3 * 4;

            float pfNormal[3] = { 0.0f, -1.0f, 0.0f };

            memcpy(pfNormals + iCurrentIndex, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 3, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 6, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 9, pfNormal, 3 * 4);

            float pfColor[3] = { 1.0f, 0.0f, 0.0f };

            memcpy(pfColors + iCurrentIndex, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 3, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 6, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 9, pfColor, 3 * 4);

            float pfVertex0[3] = {currX,-firstY,currZ};
            float pfVertex1[3] = {currX + Xstep,-firstY,currZ};
            float pfVertex2[3] = {currX + Xstep,-firstY,currZ + Zstep};
            float pfVertex3[3] = {currX,-firstY,currZ + Zstep};

            memcpy(pfVertices + iCurrentIndex, pfVertex0, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 3, pfVertex1, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 6, pfVertex2, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 9, pfVertex3, 3 * 4);

            iVertexIndex++;
        }

        for (currX = -firstX, x_status = 0.0f; currX < firstX - Xstep / 2.0f; currX += Xstep, x_status += Xstep)
        {
            int iCurrentIndex = iVertexIndex * 3 * 4;

            float pfNormal[3] = { 0.0f, 1.0f, 0.0f };

            memcpy(pfNormals + iCurrentIndex, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 3, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 6, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 9, pfNormal, 3 * 4);

            float pfColor[3] = { 0.0f, 1.0f, 0.0f };

            memcpy(pfColors + iCurrentIndex, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 3, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 6, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 9, pfColor, 3 * 4);

            float pfVertex0[3] = {currX + Xstep,firstY,currZ + Zstep};
            float pfVertex1[3] = {currX + Xstep,firstY,currZ};
            float pfVertex2[3] = {currX,firstY,currZ};
            float pfVertex3[3] = {currX,firstY,currZ + Zstep};

            memcpy(pfVertices + iCurrentIndex, pfVertex0, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 3, pfVertex1, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 6, pfVertex2, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 9, pfVertex3, 3 * 4);

            iVertexIndex++;
        }
    }

    // the front and the back of the box
    for (currY = -firstY, y_status = 0.0f; currY < firstY - Ystep / 2.0f ; currY += Ystep, y_status += Ystep)
    {
        for (currX = -firstX, x_status = 0.0f; currX < firstX - Xstep / 2.0f; currX += Xstep, x_status += Xstep)
        {
            int iCurrentIndex = iVertexIndex * 3 * 4;

            float pfNormal[3] = { 0.0f, 0.0f, 1.0f };

            memcpy(pfNormals + iCurrentIndex, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 3, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 6, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 9, pfNormal, 3 * 4);

            float pfColor[3] = { 0.0f, 0.0f, 1.0f };

            memcpy(pfColors + iCurrentIndex, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 3, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 6, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 9, pfColor, 3 * 4);

            float pfVertex0[3] = {currX,currY,firstZ};
            float pfVertex1[3] = {currX + Xstep,currY,firstZ};
            float pfVertex2[3] = {currX + Xstep,currY + Ystep,firstZ};
            float pfVertex3[3] = {currX,currY + Ystep,firstZ};

            memcpy(pfVertices + iCurrentIndex, pfVertex0, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 3, pfVertex1, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 6, pfVertex2, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 9, pfVertex3, 3 * 4);

            iVertexIndex++;
        }

        for (currX = -firstX, x_status = 0.0f; currX < firstX - Xstep / 2.0f; currX += Xstep, x_status += Xstep)
        {
            int iCurrentIndex = iVertexIndex * 3 * 4;

            float pfNormal[3] = { 0.0f, 0.0f, -1.0f };

            memcpy(pfNormals + iCurrentIndex, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 3, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 6, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 9, pfNormal, 3 * 4);

            float pfColor[3] = { 0.0f, 1.0f, 1.0f };

            memcpy(pfColors + iCurrentIndex, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 3, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 6, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 9, pfColor, 3 * 4);

            float pfVertex0[3] = {currX + Xstep,currY + Ystep,-firstZ};
            float pfVertex1[3] = {currX + Xstep,currY,-firstZ};
            float pfVertex2[3] = {currX,currY,-firstZ};
            float pfVertex3[3] = {currX,currY + Ystep,-firstZ};

            memcpy(pfVertices + iCurrentIndex, pfVertex0, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 3, pfVertex1, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 6, pfVertex2, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 9, pfVertex3, 3 * 4);

            iVertexIndex++;
        }
    }

    // Right side and the left side of the box
    for (currY = -firstY, y_status = 0.0f; currY < firstY - Ystep / 2.0f; currY += Ystep, y_status += Ystep)
    {
        for (currZ = -firstZ, z_status = 0.0f; currZ < firstZ - Zstep / 2.0f; currZ += Zstep, z_status += Zstep)
        {
            int iCurrentIndex = iVertexIndex * 3 * 4;

            float pfNormal[3] = { 1.0f, 0.0f, 0.0f };

            memcpy(pfNormals + iCurrentIndex, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 3, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 6, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 9, pfNormal, 3 * 4);

            float pfColor[3] = { 1.0f, 0.0f, 1.0f };

            memcpy(pfColors + iCurrentIndex, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 3, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 6, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 9, pfColor, 3 * 4);

            float pfVertex0[3] = {firstX,currY,currZ};
            float pfVertex1[3] = {firstX,currY + Ystep,currZ};
            float pfVertex2[3] = {firstX,currY + Ystep,currZ + Zstep};
            float pfVertex3[3] = {firstX,currY,currZ + Zstep};

            memcpy(pfVertices + iCurrentIndex, pfVertex0, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 3, pfVertex1, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 6, pfVertex2, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 9, pfVertex3, 3 * 4);

            iVertexIndex++;
        }

        for (currZ = -firstZ, z_status = 0.0f; currZ < firstZ - Zstep / 2.0f; currZ += Zstep, z_status += Zstep)
        {
            int iCurrentIndex = iVertexIndex * 3 * 4;

            float pfNormal[3] = { -1.0f, 0.0f, 0.0f };

            memcpy(pfNormals + iCurrentIndex, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 3, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 6, pfNormal, 3 * 4);
            memcpy(pfNormals + iCurrentIndex + 9, pfNormal, 3 * 4);

            float pfColor[3] = { 1.0f, 1.0f, 0.0f };

            memcpy(pfColors + iCurrentIndex, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 3, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 6, pfColor, 3 * 4);
            memcpy(pfColors + iCurrentIndex + 9, pfColor, 3 * 4);

            float pfVertex0[3] = {-firstX,currY,currZ};
            float pfVertex1[3] = {-firstX,currY,currZ + Zstep};
            float pfVertex2[3] = {-firstX,currY + Ystep,currZ + Zstep};
            float pfVertex3[3] = {-firstX,currY + Ystep,currZ};

            memcpy(pfVertices + iCurrentIndex, pfVertex0, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 3, pfVertex1, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 6, pfVertex2, 3 * 4);
            memcpy(pfVertices + iCurrentIndex + 9, pfVertex3, 3 * 4);

            iVertexIndex++;
        }
    }

    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    glEnableClientState(GL_NORMAL_ARRAY);

    glColorPointer(3, GL_FLOAT, 0, (void*)pfColors);
    glNormalPointer(GL_FLOAT, 0, (void*)pfNormals);
    glVertexPointer(3, GL_FLOAT, 0, (void*)pfVertices);

    glDrawArrays(GL_QUADS, 0, (iTopButtonQuads + iLeftRightQuads + iFrontBackQuads) * 4);

    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);

    delete [] pfVertices;
    delete [] pfNormals;
    delete [] pfColors;
}

结果会像

这是使用创建数组的示例,用于收集一些形状统计信息

    // Example 
    // Find min-max of shapes coordinates

    // Get coord of first vertex
    float fMinX = pfVertices[0];
    float fMinY = pfVertices[1];
    float fMinZ = pfVertices[2];

    float fMaxX = pfVertices[0];
    float fMaxY = pfVertices[1];
    float fMaxZ = pfVertices[2];

    for (int iVertexIndex = 0; iVertexIndex < (iTopButtonQuads + iLeftRightQuads + iFrontBackQuads) * 4; iVertexIndex++)
    {
        int iCurrentIndex = iVertexIndex * 3; // (x y z) per vertex

        if (pfVertices[iCurrentIndex] < fMinX)
            fMinX = pfVertices[iCurrentIndex];

        if (pfVertices[iCurrentIndex + 1] < fMinY)
            fMinY = pfVertices[iCurrentIndex + 1];

        if (pfVertices[iCurrentIndex + 2] < fMinZ)
            fMinZ = pfVertices[iCurrentIndex + 2];

        if (pfVertices[iCurrentIndex] > fMaxX)
            fMaxX = pfVertices[iCurrentIndex];

        if (pfVertices[iCurrentIndex + 1] > fMaxY)
            fMaxY = pfVertices[iCurrentIndex + 1];

        if (pfVertices[iCurrentIndex + 2] > fMaxZ)
            fMaxZ = pfVertices[iCurrentIndex + 2];
    }

    // Create an axes aligned bounding box 
    // by simply drawing inflated min-maxes, that we collect
    // example of using indexed primitives

    glDisable(GL_CULL_FACE);

    GLfloat vertices[] = {
        fMinX - 2.0, fMaxY + 2.0, fMaxZ + 2.0,
        fMaxX + 2.0, fMaxY + 2.0, fMaxZ + 2.0,
        fMaxX + 2.0, fMinY - 2.0, fMaxZ + 2.0,
        fMinX - 2.0, fMinY - 2.0, fMaxZ + 2.0,
        fMinX - 2.0, fMaxY + 2.0, fMinZ - 2.0,
        fMaxX + 2.0, fMaxY + 2.0, fMinZ - 2.0,
        fMaxX + 2.0, fMinY - 2.0, fMinZ - 2.0,
        fMinX - 2.0, fMinY - 2.0, fMinZ - 2.0
    };

    GLint indices[] = {
        0, 1, 2, 3,
        4, 5, 1, 0,
        3, 2, 6, 7,
        5, 4, 7, 6,
        1, 5, 6, 2,
        4, 0, 3, 7 
    };

    glColor3f(1.0f, 1.0f, 1.0f);

    glEnableClientState(GL_VERTEX_ARRAY);

    glVertexPointer(3, GL_FLOAT, 0, (void*)vertices);

    glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, (void*)indices);

    glDisableClientState(GL_VERTEX_ARRAY);

    glEnable(GL_CULL_FACE);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

曲面细分的理论和算法 的相关文章

  • 如何自定义舍入形式

    我的问题可能看起来很简单 但仍然无法得到有效的东西 我需要自定义 Math round 舍入格式或其他格式以使其工作如下 如果数字是 1 6 他应该四舍五入到 1 如果大于或等于 1 7 他应该四舍五入到 2 0 对于所有其他带有 6 的小
  • 从三点求圆心的算法是什么?

    我在圆的圆周上有三个点 pt A A x A y pt B B x B y pt C C x C y 如何计算圆心 在Processing Java 中实现它 我找到了答案并实施了一个可行的解决方案 pt circleCenter pt A
  • ASP.NET Core 与现有的 IoC 容器和环境?

    我想运行ASP NET 核心网络堆栈以及MVC在已托管现有应用程序的 Windows 服务环境中 以便为其提供前端 该应用程序使用 Autofac 来处理 DI 问题 这很好 因为它已经有一个扩展Microsoft Extensions D
  • 在 C++ 中将成对向量转换为两个独立向量的最快方法

    假设我有一个vector of pair
  • 为什么大多数平台上没有“aligned_realloc”?

    MSVC有自己的非标准函数 aligned malloc aligned realloc and aligned free C 17和C11引入了 std aligned alloc 其结果可以是de分配有free or realloc B
  • (const T v) 在 C 中从来都不是必需的,对吗?

    例如 void func const int i 在这里 const是不必要的 因为所有参数都是按值传递的 包括指针 真的吗 C 中的所有参数确实都是按值传递 这意味着无论您是否包含该参数 实际参数都不会改变const or not 然而
  • 选择列表逻辑应位于 ASP.NET MVC、视图、模型或控制器中的什么位置?

    我觉得我的问题与这个问题很接近 但我想对这样的代码应该放在哪里进行更一般的讨论 Asp Net MVC SelectList 重构问题 https stackoverflow com questions 2149855 asp net mv
  • 如何创建用于 QML 的通用对象模型?

    我想知道是否有任何宏或方法如何将 Qt 模型注册为 QObject 的属性 例如 我有AnimalModel http doc qt io qt 5 qtquick modelviewsdata cppmodels html qabstra
  • 如何生成 appsettings..json 文件?

    我有一个 ASP NET Core 2 WebAPI 它将部署在以下环境中 INT QA STAGE 生产环境 基于上述 我需要有appsettings
  • OpenGL - 两个纹理的幂

    OpenGL 使用二次幂纹理 这是因为由于 MipMapping 某些 GPU 只接受 2 的幂纹理 当绘制比实际更大的纹理时 使用这些二次方纹理会导致问题 我想到了一种方法来解决这个问题 即仅在我们使纹理小于实际大小时使用 PO2 比率
  • 预处理后解析 C++ 源文件

    我正在尝试分析c 使用我定制的解析器的文件 写在c 在开始解析之前 我想摆脱所有 define 我希望源文件在预处理后可以编译 所以最好的方法是运行C Preprocessor在文件上 cpp myfile cpp temp cpp or
  • 为什么具有相同名称但不同签名的多个继承函数不会被视为重载函数?

    以下代码片段在编译期间产生 对 foo 的调用不明确 错误 我想知道是否有任何方法可以解决此问题而不完全限定对 foo 的调用 include
  • 分配器感知容器和propagate_on_container_swap

    The std allocator traits模板定义了一些常量 例如propagate on container copy move assign让其他容器知道它们是否应该在复制或移动操作期间复制第二个容器的分配器 我们还有propag
  • C++11 动态线程池

    最近 我一直在尝试寻找一个用于线程并发任务的库 理想情况下 是一个在线程上调用函数的简单接口 任何时候都有 n 个线程 有些线程比其他线程完成得更快 并且到达的时间不同 首先我尝试了 Rx 它在 C 中非常棒 我还研究了 Blocks 和
  • tabcontrol selectedindex 更改事件未被触发 C#

    嘿伙计们 我有一个很小的问题 请参阅下面的代码 this is main load private void Form1 Load object sender EventArgs e tabAddRemoveOperator Selecte
  • asp.net网格分页的SQL查询

    我在用iBatis and SQLServer 使用偏移量和限制进行分页查询的最佳方法是什么 也许我添加该列ROW NUMBER OVER ORDER BY Id AS RowNum 但这只会阻止简单查询的数据访问 在某些情况下 我使用选择
  • ASP.NET JQuery AJAX POST 返回数据,但在 401 响应内

    我的应用程序中有一个网页 需要调用我设置的 Web 服务来返回对象列表 这个调用是这样设置的 document ready function var response ajax type POST contentType applicati
  • 初始化 LPCTSTR /LPCWSTR [重复]

    这个问题在这里已经有答案了 我很难理解并使其正常工作 基本上归结为我无法成功初始化这种类型的变量 它需要有说的内容7 2E25DC9D 0 USB003 有人可以解释 展示这种类型的正确初始化和类似的值吗 我已查看此站点上的所有帮助 将项目
  • 在 C++17 中使用 成员的链接错误

    我在 Ubuntu 16 04 上使用 gcc 7 2 并且需要使用 C 17 中的新文件系统库 尽管确实有一个名为experimental filesystem的库 但我无法使用它的任何成员 例如 当我尝试编译此文件时 include
  • 类中不允许使用不完整类型,但类模板中允许使用不完整类型

    以下为无效代码 struct foo struct bar bar x error field x has incomplete type struct bar int value 42 int main return foo x valu

随机推荐

  • 静态库中的 Objective-C 类别

    你能指导我如何正确地将静态库链接到 iPhone 项目吗 我使用添加到应用程序项目中的静态库项目作为直接依赖项 目标 gt 常规 gt 直接依赖项 并且所有工作正常 但类别 静态库中定义的类别在应用程序中不起作用 所以我的问题是如何将某些类
  • 在 django 中使用 pika 的 Rabbitmq 监听器

    我有一个 django 应用程序 我想使用来自rabbit mq 的消息 我希望监听器在启动 django 服务器时开始使用 我正在使用 pika 库连接到rabbitmq 提供一些代码示例确实会有帮助 首先 您需要在 django 项目开
  • Chrome 扩展程序:无法加载 JavaScript 文件

    我发布了有关我的 Chrome 扩展程序的另一个问题here https stackoverflow com questions 28303597 tumblr dashboard modifications per chrome exte
  • 使用 apply 函数填充 NA 矩阵

    我想使用 apply 函数填充一个空矩阵 例如我的目的是简化下面的代码 tmp lt matrix NA 10 10 tmp 1 lt sample 1 500 10 tmp 2 lt sample 1 500 10 tmp 10 lt s
  • 在 PHP 中获取 SCOPE_IDENTITY()

    一直在尝试获取 SCOPE IDENTITY 插入数据库的最后一个 ID 并将其作为变量存储在我的 PHP 函数中 看了我在 stackoverflow 上可能找到的所有答案 但我仍然没有找到答案 这就是我目前所拥有的 Confirm bo
  • 创建现有 SOAP Web 服务的 REST 包装器

    我有一个 NET Web 服务 它是一个 SOAP 服务 我想将其转换为 REST 服务 我必须使用哪些选项来创建该中间件才能 接受请求并致电肥皂服务 翻译 SOAP 服务返回的结果 将响应返回给请求者 你有两个选择 1 只需创建一个具有两
  • 仅协议方案支持跨源请求,我该怎么办?

    我无法向 php 发送信息 它被阻止了 仅协议方案支持跨源请求 http data chrome chrome extension https 我使用了不同的 只有三分之一的电脑可以使代码工作 document on ready funct
  • Azure 服务总线主题分区

    我正在尝试向使用两者创建的主题发送消息启用重复检测 and 启用分区选项已选中 我不设置SessionId and PartitionKey我的属性BrokeredMessage实例 根据this https learn microsoft
  • 在 Android 中使用 AES/CBC/PKCS5Padding 解密不正确

    我在 Android v2 2 API 8 中编写了以下代码 其中输入纯文本 代码使用用户密码和随机盐对其进行加密 然后解密 运行代码后 我只得到部分正确的纯文本 例如用户输入 Msg 1 5 to encrypt 解密结果为 Msg15t
  • 将字节数组解码为Java中已压缩的位图

    我按以下方式压缩位图 Bitmap bmpSig getMyBitMap int size bmpSig getWidth bmpSig getHeight ByteArrayOutputStream out new ByteArrayOu
  • 如何在 dart 中创建安全的 http 服务器?

    我正在尝试将 dart http 服务器设置为仅使用 https 运行 所以我认为我需要使用HttpServer bindSecure https api dartlang org apidocs channels stable dartd
  • 在 shell 中导出函数

    请告诉我如何在父 shell bash sh 或 ksh 中导出函数 以便该函数可供从父进程启动的所有子进程使用 The export fBash 特有的功能 parent bin bash plus1 echo 1 1 echo plus
  • 无法在 Windows 计算机上安装 sasl-0.1.3 python 包

    我正在尝试在 Windows 7 64 位机器 上安装 sasl 0 1 3 python 包 它出现 C1083 致命错误 看起来 saslwrapper cpp 无法在 c 模块中包含 sasl sasl h 库 请帮助我解决问题 如果
  • boost::32 和 64 位进程之间的进程间共享内存

    我试图让 boost interprocess 在 32 位和 64 位进程之间共享内存 此错误跟踪器条目 https svn boost org trac boost ticket 5230表明这在我使用的 Boost 1 49 中可能是
  • 在模板中表达左移或右移的优雅方式

    我目前有一个模板函数 根据其模板参数 A 和 B 可以向左或向右移动值 template
  • 以编程方式设置 MailItem 的后续标志来完成?

    我试图找出如何在 Outlook 2007 中通过 VBA 将 MailItem 的后续标志设置为完成 谷歌搜索返回了大量在 Outlook 2003 及之前版本中有效的方法 例如 更改 MailItem 的 FlagStatus 属性的值
  • 如何处理静态存储持续时间警告?

    我是一个试图从书本上学习 C 的新手 下面的代码可以正常工作并产生预期的输出 但是定义的两行有警告engine and randomInt 使用静态存储持续时间初始化 引擎 可能会引发无法捕获的异常 如果我将第 7 行和第 8 行放在mai
  • .NET 错误关闭串口 BaseStream 错误仅在端口打开时出现

    我正在使用 NET System IO Ports SerialPort 并按照本文中的建议使用 BaseStreamIf you must使用 NET System IO Ports SerialPort http www sparxen
  • 对角块矩阵行之间的组合列表

    我有以下 R 矩阵 它是 2x3 和 3x3 子矩阵的组合 它可以是 2 个以上具有不同维度的子矩阵 例如 m1xp 和 m2xp 和 m3xp 其中 m1 m2 m3 A2 lt list rbind c 1 1 1 c 1 1 1 rb
  • 曲面细分的理论和算法

    我有以下问题 以下是我在屏幕上绘制立方体的方法 void drawCube glClear GL COLOR BUFFER BIT GL DEPTH BUFFER BIT Clear color and depth buffers glPu