小编Jef*_*ard的帖子

适用于初学者的CGAL教程

任何人都可以为初学者推荐一套好的CGAL教程吗?我试过阅读文档,但即使作为一个经验丰富的C++程序员,它对我来说似乎非常密集.因此,我试图通过解决简单的问题来学习,但即使这样也令人困惑.例如,我现在特别想解决的问题如下:从3D点云中找到凸包,然后在凸包的有限面上循环并打印每个面的顶点.似乎应该有一种直截了当的方法来做到这一点; 我原本以为3D多面体会拥有一个facet对象的向量,每个对象都会拥有一个边缘向量,每个向量都会拥有一个顶点向量,并且它们可以通过这个访问它们.使用迭代器的层次结构.

c++ cgal computational-geometry

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

Java:如何使这个主线程等待新线程终止

我有一个java类,使用ProcessBuilder创建一个名为child的进程.子进程生成大量输出,我在一个单独的线程上耗尽,以防止主线程被阻塞.但是,稍后我需要等待输出线程完成/终止才能继续,我不知道该怎么做.我认为join()是通常的方法,但在这种情况下我不确定如何做到这一点.这是java代码的相关部分.

    // Capture output from process called child on a separate thread

    final StringBuffer outtext = new StringBuffer("");
    new Thread(new Runnable() {
        public void run() {
            InputStream in = null;
            in = child.getInputStream();
            try {
                if (in != null) {
                    BufferedReader reader = new BufferedReader(new InputStreamReader(in));
                    String line = reader.readLine();
                    while ((line != null)) {
                        outtext.append(line).append("\n");
                        ServerFile.appendUserOpTextFile(userName, opname, outfile, line+"\n");
                        line = reader.readLine();
                    }
                }
            } catch (IOException iox) {
                throw new RuntimeException(iox);
            }
        }
    }).start();

    // Write input to …
Run Code Online (Sandbox Code Playgroud)

java multithreading

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

带有嵌入式码头的Webapp提供异常

我正在尝试使用Java 7和Jetty 9.1.3维护一个使用嵌入式jetty独立运行的java Web应用程序.除了其中一个JSP页面中的所有链接外,其他所有内容都会运行.该页面上的每个链接都应该获取png文件或文本文件,并将其显示在链接下方.通过Netbeans运行时,每个链接在单击时都会挂起,并且控制台会出现以下错误:

Apr 10, 2014 4:23:34 PM org.apache.struts.chain.commands.AbstractExceptionHandler execute
WARNING: Unhandled exception
java.lang.IllegalStateException: Form too many keys
at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To(UrlEncoded.java:526)
at org.eclipse.jetty.util.UrlEncoded.decodeTo(UrlEncoded.java:625)
at org.eclipse.jetty.server.Request.extractParameters(Request.java:344)
at org.eclipse.jetty.server.Request.getParameterNames(Request.java:852)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:426)
at org.apache.struts.chain.commands.servlet.PopulateActionForm.populate(PopulateActionForm.java:50)
at org.apache.struts.chain.commands.AbstractPopulateActionForm.execute(AbstractPopulateActionForm.java:60)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:711)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:568)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1112)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:479)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1046)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:462)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:281)
at …
Run Code Online (Sandbox Code Playgroud)

java jsp embedded-jetty

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

为什么派生类不会访问非虚基类函数?

我无法使派生类访问基类中定义的函数.基类头文件名为Particle.h,它是:

class Particle {
    protected:
        vector<double> x_,y_,z_;

        // lots of other protected members that are not relevant to the question

    public:

        // constructors and other functions not relevant to question are omitted
        virtual double getX(const unsigned int index, const double theta, const double phi);
        virtual vector<double> getX(const double theta, double Real phi);
        vector<double> getX(const unsigned int surfindex);
}
Run Code Online (Sandbox Code Playgroud)

该函数的定义位于名为Particle.cc的文件中:

#include "Particle.h"

vector<double> Particle::getX(const unsigned int surfindex)
{
    vector<double> xp;
    xp.clear();
    xp.resize(3,0.0);
    xp[0] = x_.at(surfindex);
    xp[1] = y_.at(surfindex);
    xp[2] = z_.at(surfindex); …
Run Code Online (Sandbox Code Playgroud)

c++ inheritance class

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

CGAL仿射变换的语法错误

我正在尝试使用CGAL库进行简单的3D翻译,我显然对语法感到困惑,因为无论我尝试什么,我都会遇到相同的编译时错误.这是一个最小的"非工作"示例:

#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Vector_3.h>
#include <CGAL/Aff_transformation_3.h>
#include <CGAL/Aff_transformation_tags.h>

typedef CGAL::Simple_cartesian<double>     Kernel;
typedef CGAL::Polyhedron_3<Kernel>         Polyhedron;
typedef Kernel::Vector_3                   Vector_3;
typedef CGAL::Aff_transformation_3<Kernel> Aff_transformation_3;

int main(void)
{
    Polyhedron P;
    P.make_tetrahedron();

    const Vector_3 transvec(-1,0,2);

    Aff_transformation_3 transl(CGAL::Translation, transvec);
    transform(P.points_begin(),P.points_end(),P.points_begin(),transl);
}
Run Code Online (Sandbox Code Playgroud)

我尝试编译

g++ -O2 -frounding-math -I/usr/local/include -I/opt/local/include mwe.cc -Wl, -lCGAL -lCGAL_Core -lCGAL_ImageIO -lmpfr -lgmp -lm -o mwe
Run Code Online (Sandbox Code Playgroud)

在此我总是收到这个错误:

mwe.cc:19:52: error: unknown type name 'transvec'
Aff_transformation_3 transl(CGAL::Translation, transvec);
Run Code Online (Sandbox Code Playgroud)

c++ cgal

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